Fenics installation : I am lost, nothing works, I cannot even begin to test fenics

Hi,

I’m trying to install fenics on Ubuntu 20.4. My goal is to use it with Pycharm.

Trial 1 :
I installed fenics with instructions : Solving PDEs in Python - <br> The FEniCS Tutorial Volume I
Installation worked well, all instructions were accepted with no error.
But the test part python -c 'import fenics' gives ModuleNotFoundError: No module named 'fenics' … why ??

Trial 2 :
using fenics documentation from fenicsproject org /download/ :
I installed fenics through what I found here fenics.readthedocs io/en/latest/installation.html#debian-ubuntu-packages
Installation worked, again. But again python -c 'import fenics' gives ModuleNotFoundError: No module named 'fenics'.

Trial 3 :
As the goal is to use it with Pycharm, I tried through Pycharm :
I installed it through pycharm settings/interpreter section : fenics is installed OK, but not recognized when I call import fenics . Following helps in forums I tried to install dijitso, dolfin, ffc, instant => but dolfin and ffc are simply impossible to find : ERROR: No matching distribution found for DOLFIN . When searching for doc about dolfin : https://fenicsproject.org/docs/dolfin/ : error 404. :cold_sweat:

I try whatever I find on forums but maybe I am wrong in my search, I mostly found solutions giving broken links…

Fenics seems to be wonderful but how one should begin with it ? From the official FEniCS Reference Manual : the “getting started” section is empty, in “todo” state :sob:
I’m lost.

Help

Thank you for your attention and help

I can’t reproduce your error

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal

$ python3 -c "import fenics; print(fenics.__path__)"
['/usr/lib/python3/dist-packages/fenics']

Check you don’t have any old interfering installations, e.g. installed by pip into .local.

2 Likes

Could it be as simple as using python3 instead of python? The linked tutorial is somewhat outdated, and recent versions of FEniCS only support Python 3.

3 Likes

Hi,

Thank your for your prompt help !
It was well guessed : there were several python versions.
Since I installed Anaconda, the python version used when calling “python” from a terminal was the anaconda one, and the python version where the fenics package was installed was the usr/lib/python3 one.
As it was a brand new computer I solved it basically in reinstalling ubuntu from scratch, to avoid fighting in knowing which python version was there before others. Now I’ll try to get fenics working prior to installing anything else.

Now it visibly does not work yet : I get Invalid MIT-MAGIC-COOKIE-1 key when I try python3 -c 'import fenics', but that is another story.

Thanks again

The Invalid MIT-MAGIC-COOKIE-1 is a tough one to eliminate. I’ve had it in the past, it never actually went away until I got a new computer. On the other hand, it’s mostly harmless, shouldn’t affect your calculations.