Problem With Fenics Install on Ubuntu

2,445 views
Skip to first unread message

Fraser Baigent

unread,
Sep 26, 2018, 9:52:43 AM9/26/18
to fenics-support
Good afternoon,

OS: Ubuntu 18.04.1 LTS   
Python version : 2.7

My fenics was running fine and up to date yesterday, I updated the system by :

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

Now, when I run a script (e.g. ft01_poisson.py from the tutorial) wither as an executable or through python I recieve the error: 

./ft01_poisson.py
>Traceback (most recent call last): 
> File "./ft01_poisson.py", line 14, in <module>
>   from fenics import *
>ImportError: No module named fenics

python2 ft01_posson.py
>Traceback (most recent call last):
> File "ft01_poisson.py", line 14, in <module>
>   from fenics import *
>ImportError: No module named fenics

It appears that the python package of fenics is no longer there. 

ls /usr/local/lib/python2.7/dist-packages/fenics
> ls: cannot access '/usr/local/lib/python2.7/dist-packages/fenics': No such file or directory

python -c 'import fenics'
>Traceback (most recent call last):
> File "<string>", line 1, in <module>
>ImportError: No module named fenics

sudo apt list --installed | grep fenics 
>
>WARNING: apt does not have a stable CLI interface. Use with caution in scripts. 
>
>fenics/bionic,bionic,now 1:2018.1.0.2~ppa1~bionic1 all [installed]
>pybind11-dev/bionic,bionic,now 2.2.3-1fenics1bionic1 all [installed,automatic]
>python3-pybind11/bionic,bionic,now 2.2.3-1fenics1bionic1 all [installed,automatic]

It seems that fenics is installed but python can't find it, do I have to change the directory which I've installed it in to or change my python config to send a fenics import to another directory? Obviously I'm not really keen to adjust the config files as there's so many dependencies.

Cheers
Fraser

Fraser Baigent

unread,
Sep 26, 2018, 10:03:34 AM9/26/18
to fenics-support
Just going to reply quickly, and say the last time I used fenics it was supporting python 2.

I've tried running it through python 3 and it's working, however obviously there are some legacy issues in the python2 formatting in the examples (e.g. print "t="%t instead of print("t="%t)).

Regards
Fraser

Johannes Ring

unread,
Sep 26, 2018, 10:04:34 AM9/26/18
to fraser...@googlemail.com, fenics-support
On Wed, Sep 26, 2018 at 3:52 PM 'Fraser Baigent' via fenics-support <fenics-...@googlegroups.com> wrote:
Good afternoon,

OS: Ubuntu 18.04.1 LTS   
Python version : 2.7

My fenics was running fine and up to date yesterday, I updated the system by :

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

This installed the latest stable version of FEniCS (2018.1.0), which is Python 3 only.
 
Now, when I run a script (e.g. ft01_poisson.py from the tutorial) wither as an executable or through python I recieve the error: 

./ft01_poisson.py
>Traceback (most recent call last): 
> File "./ft01_poisson.py", line 14, in <module>
>   from fenics import *
>ImportError: No module named fenics

python2 ft01_posson.py

Try:

  python3 ft01_posson.py
 
>Traceback (most recent call last):
> File "ft01_poisson.py", line 14, in <module>
>   from fenics import *
>ImportError: No module named fenics

Replace `from fenics import *` with `from dolfin import *`.

Johannes
 
It appears that the python package of fenics is no longer there. 

ls /usr/local/lib/python2.7/dist-packages/fenics
> ls: cannot access '/usr/local/lib/python2.7/dist-packages/fenics': No such file or directory

python -c 'import fenics'
>Traceback (most recent call last):
> File "<string>", line 1, in <module>
>ImportError: No module named fenics

sudo apt list --installed | grep fenics 
>
>WARNING: apt does not have a stable CLI interface. Use with caution in scripts. 
>
>fenics/bionic,bionic,now 1:2018.1.0.2~ppa1~bionic1 all [installed]
>pybind11-dev/bionic,bionic,now 2.2.3-1fenics1bionic1 all [installed,automatic]
>python3-pybind11/bionic,bionic,now 2.2.3-1fenics1bionic1 all [installed,automatic]

It seems that fenics is installed but python can't find it, do I have to change the directory which I've installed it in to or change my python config to send a fenics import to another directory? Obviously I'm not really keen to adjust the config files as there's so many dependencies.

Cheers
Fraser

--
You received this message because you are subscribed to the Google Groups "fenics-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-suppor...@googlegroups.com.
To post to this group, send email to fenics-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fenics-support/0b6c9688-0ccd-4550-9ec1-c4df7586ab0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fraser Baigent

unread,
Sep 26, 2018, 10:05:53 AM9/26/18
to fenics-support


On Wednesday, 26 September 2018 15:03:34 UTC+1, Fraser Baigent wrote:
Just going to reply quickly, and say the last time I used fenics it was supporting python 2.

I've tried running it through python 3 and it's working, however obviously there are some legacy issues in the python2 formatting in my examples (e.g. print "t="%t instead of print("t="%t)).

Bharat Vyakaranam

unread,
Oct 4, 2018, 8:55:04 PM10/4/18
to fenics-support

Hi ,
I Recently installed FEniCS frm Ubuntu (18.04) with the following instructions provide in the documentation:

 

sudo apt-get install --no-install-recommends software-properties-common

sudo add-apt-repository ppa:fenics-packages/fenics

sudo apt-get update

sudo apt-get install --no-install-recommends fenics

 

I ran a couple of examples (please find them attached) that were mentioned in the documentation but I got some errors. I am using Python 3.

 

When I ran Example1: ft01_poisson.py, got the following error message:

 

Solving linear variational problem.

*** Warning: Degree of exact solution may be inadequate for accurate result in errornorm.

error_L2  = 0.008235098073354943

error_max = 1.3322676295501878e-15

Traceback (most recent call last):

  File "ft01_poisson.py", line 60, in <module>

    interactive()

NameError: name 'interactive' is not defined

 

When I ran Example 7: ft07_navier_stokes_channel.py, got the following error message:

 

Traceback (most recent call last):

  File "ft07_navier_stokes_channel.py", line 118, in <module>

    error = np.abs(u_e.vector().array() - u_.vector().array()).max()

AttributeError: 'dolfin.cpp.la.PETScVector' object has no attribute 'array'

 

Could you please suggest how to resolve these issues?

 

Thanks and regards,

-Bharat

Johannes Ring

unread,
Oct 5, 2018, 5:50:13 AM10/5/18
to bhara...@gmail.com, fenics-support

--
You received this message because you are subscribed to the Google Groups "fenics-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-suppor...@googlegroups.com.
To post to this group, send email to fenics-...@googlegroups.com.

Bharat Vyakaranam

unread,
Oct 5, 2018, 6:04:41 PM10/5/18
to fenics-support
Hi Johannes,

Thank you for your message!

As you suggested, I have taken examples from here "https://fenicsproject.org/docs/dolfin/2018.1.0/python/demos" and ran a few of them but still getting errors:

Example1:

Traceback (most recent call last):
  File "/media/sf_shared-ubuntu/fenics-tutorial-master/pub/python/vol1/demo_poisson.py", line 170, in <module>
    solve(a == L, u, bc)

 it cannot be differentiated.''' % expr))
ValueError: 
Since there are no variables in the expression [0, 0, 0], it cannot be
differentiated.

Example2:

  File "/media/sf_shared-ubuntu/fenics-tutorial-master/pub/python/vol1/demo_auto-adaptive-poisson.py", line 250, in <module>
    problem = LinearVariationalProblem(a, L, u, bc)

 it cannot be differentiated.''' % expr))
ValueError: 
Since there are no variables in the expression [0, 0, 0], it cannot be
differentiated.

Could you please help me to resolve these issues?

Thanks,
-Bharat

Johannes Ring

unread,
Oct 8, 2018, 5:42:59 AM10/8/18
to bhara...@gmail.com, fenics-support

You probably have a local copy of SymPy installed in /usr/local or ~/.local. Removing this should fix the problem.

Johannes

陆杨龙

unread,
Oct 8, 2018, 11:07:21 AM10/8/18
to Johannes Ring, bhara...@gmail.com, fenics-support
Hi Johannes,
Thanks for your help. After I removed SymPy, I am asked to infall FFC like "DOLFIN runtime dependency is not met. Install the following python module: 'ffc' and make sure its location is listed in PYTHONPATH". After I installed FFC, same error happened as before like In instant.recompile: The module did not compile with command 'make VERBOSE=1’.
best
Yanglong

Johannes Ring

unread,
Oct 8, 2018, 11:49:57 AM10/8/18
to luyangl...@gmail.com, bhara...@gmail.com, fenics-support
Hi Yanglong,

Have you also installed FEniCS from the FEniCS PPA on Ubuntu 18.04? If so, how did you install FFC? FFC is already part of the installation from the FEniCS PPA.

Johannes

Bharat Vyakaranam

unread,
Oct 8, 2018, 7:28:40 PM10/8/18
to fenics-support
Thank you Johannes for your inputs!

The problems have been resolved.

-Bharat
Reply all
Reply to author
Forward
0 new messages