Installation problem. Fail to import fenics

Good morning everyone. I am trying to install fenics on my new laptop. It is the Pop-os system, which is based on Ubunto.

First of all, I followed the steps on the website to install fenics. I choose to use conda and I used followed command to install

Then I successfully installed by this method. However, when I try to use it through jupyter lab. There is an error called no module named ‘fenics’, I changed it to ‘fenicsx’, but it still failed.

It really confused me, and I also activate the conda fenicsx-env before this. I also checked the pip list under the fenicsx-env. It shows there is fenics

Moreover, I also considered the possibility that I need to use dolfin and dolfinx instead of fenics and fenicsx, however, the same issue occurs

Moreover, I also did a final check using python3 -c ‘import XXX’ in terminal for fenics, fenicsx, dolfin, and dolfinx. Only dolfinx went through and all other three modules failed(It is checked after I activate the fenicsx-env in conda)

Any advice and help are appreciated!

You have installed the FEniCS module dolfinx, which is successfully imported.

In legacy dolfin you could import the dolfin package in two ways

  1. import dolfin
  2. import fenics (which would call import dolfin as fenics).

This is confusing, and thus for FEniCSx, the modules can all be imported individually:

import dolfinx
import ffcx
import basix
import ufl

For usage of FEniCSx see for instance:

1 Like

I see. Thanks for your help.