importing dolfin from the Spyder shell

Asked by Bento

I would like to use the Spyder development environment for Dolfin. However import does not work from the Spyder shell or when running files from inside Spyder. Importing Dolfin from python in the terminal works. Does anyone have similar problems?
Here is the output, when I try to import dolfin from inside Spyder:

>>> from dolfin import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bento/FEniCS/lib/python2.6/site-
packages/dolfin/__init__.py", line 13, in <module>
     from dolfin.cppimports import *
  File "/home/bento/FEniCS/lib/python2.6/site-
packages/dolfin/cppimports.py", line 4, in <module>
     import dolfin.cpp as cpp
  File "/home/bento/FEniCS/lib/python2.6/site-
packages/dolfin/cpp.py", line 28, in <module>
     _cpp = swig_import_helper()
  File "/home/bento/FEniCS/lib/python2.6/site-
packages/dolfin/cpp.py", line 24, in swig_import_helper
     _mod = imp.load_module('_cpp', fp, pathname, description)
ImportError: libdolfin.so.0: cannot open shared object file: No
such file or directory

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Bento
Solved:
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

It seems that LD_LIBRARY_PATH hasn't been set correctly. I'm not familiar with Spyder, but does it work if you run

  source /home/bento/FEniCS/share/dolfin/dolfin.conf

in a terminal and then start Spyder from the same terminal?

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#2

I already source that file in my .bashrc. And when I start Spyder out of the shell, then it works.

I now wrote a shell script to first source the dolfin.conf and then start Spyder, so that I can launch it from my desktop.

Thank you, Johannes!

Revision history for this message
Johannes Ring (johannr) said :
#3

It might help if you source dolfin.conf in .profile instead of .bashrc.

Anyway, I'm glad it works now.