Dolfinx in plain Jupyter notebook: No module named 'dolfinx'

Hello community,

I’m trying to run dolfinx in a plain Jupyter notebook on Google colab.

Installation successfully completes, using:

!add-apt-repository ppa:fenics-packages/fenics -y
!apt update && apt install fenicsx

Imports also work fine, except the last line of the following

import ufl, ffcx, basix
from mpi4py import MPI
import sys
print(sys.path)
import dolfinx

yields the error
ModuleNotFoundError: No module named ‘dolfinx’.

Is there something I’m missing? Especially since all the other packages (ufl, ffcx, basix) seem to have been installed correctly.

The print of sys.path yields
['/content', '/env/python', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '', '/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.10/dist-packages/IPython/extensions', '/root/.ipython'].

Thanks.

Best,
Marc

See https://fem-on-colab.github.io/

2 Likes