FEniCS 2019.1.0 in Ubuntu 2020.04

FEniCS passed the test of good installation using $python3 -c ‘from dolfin import *’. Equally $dolfin-version ---- 2019.1.0 and $which python3 ---- /usr/bin/python3

When running a python code using —from dolfin import * the system responds — NameError: name ‘dolfin’ is not defined’

Previous FEniCS on Ubuntu 18.04 work fine on prompt, and on Spyder. Any help much appreciated.

As this verifies that dolfin is installed, there must be something with how you run your script. Please attach the command your are running when you get your error, and the full error message.

FEniCS 19.1.0 has been installed in my machine on Ubuntu 20.04. I have also installed Python3 3.8.2 and Spyder 4.1.3. FEniCS installation passed the test of good installation by running the code: terminal> python3 -c ‘import fenics’.

I wanted to run a small text code where dolfin is imported (i.e from dolfin import * ). The system (python3 prompt or Spyder) responded with the following error message: NameError:name ‘dolfin’ is not defined.

I checked the version of dolfin on the terminal with $ dolfin-version. It responds with 2019.1.0 which is OK. When I used code to find the dolfin version, i.e. >>> from dolfin import * and then >>> print (dolfin.dolfin_version()); the system responds NameError: name ‘dolfin’ is not defined. I need help here!

When query for installed packages, the system responds among other packages as follows: fenics-digits, fenics-dolfin, fenics-ffc, fenics-fiat, fenics-ufl, dolfin-adjoint

It appears that python3 is not linking somehow with the above packages. I need help on this! What to do. Help much appreciated.

Equally, I did have Ubuntu 18.04 installed and python3 and Spyder worked OK. In order to install Ubuntu 2020.04 I started from scratch with a new Ubuntu version 20.04 and new installation of FEniCS 2019.1.0

Then change the python path in spyder: https://stackoverflow.com/questions/11919615/how-to-change-the-path-of-python-in-spyder

Thank dokken. The problem is not just with Spyder. When I use the terminal, i.e. $ python3 it change to >>> from dolfin import * next >>> which is OK then >>> print (dolfin.dolfin_version()) I also get the same error statement. Do you think your advise will also correct the error on the terminal? I think I am able to run code from the terminal without using Spyder.

There is no variable dolfin.dolfin_version() in later releases. You can obtain the version by using the command import dolfin; print(dolfin.__version__)

I have tried your instructions and I have managed to run this scrip successfully on the terminal. Thank you again. Next I will try to change the path according to your advise. I will keep you informed

Hi,
Spyder works OK when using your instruction to print the FEniCS version. No need to access path. Thank!