rizii rizii - 2 months ago 31
Python Question

Trouble importing FENiCS Dolfin on Ubuntu 14.04

I am running Ubuntu 14.04, and python 2.7.6, and have had trouble running importing DOLFIN from FEniCS. I used the following commands to install, as suggested by FENiCS documentation:

sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install fenics
sudo apt-get dist-upgrade

No errors occurred during installation, but when running the command

from dolfin import *

I get the following error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/dolfin/__init__.py", line 16, in <module>
from . import cpp
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/__init__.py", line 42, in <module>
exec("from . import %s" % module_name)
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/function.py", line 209, in <module>
class GenericFunction(ufc.function, common.Variable):
AttributeError: 'module' object has no attribute 'function'

Any help would be greatly appreciated. Thanks!


In case anyone comes across the same problem, I received a useful response to this here.

In short, somehow in my /etc/apt/sources.list.d/fenics-packages-fenics-trust.list file, I had this line for some reason:

deb http://ppa.launchpad.net/fenics-packages/fenics-exp/ubuntu trusty main

And the experimental builds are not compatible with Ubuntu 14.04. I manually changed 'fenics-exp' to 'fenics' and reinstalled, and it works now.