Module not found error ubuntu 22.04

Hi! I am trying to use fenicsx in my computer with ubuntu 22.04. I followed the instalation on the webpage:
add-apt-repository ppa:fenics-packages/fenics
apt update
apt install fenicsx
Still, when I open python and try to import fenicsx or dolfinx, i get:
ModuleNotFoundError: No module named ‘dolfinx’
Any help is appreciated,
Sara

What is the output of apt install fenicsx
and what is the output of python3 -m pip list

This is my way of reproducing your commands:

  1. Run docker with: docker run -ti --rm ubuntu:22.04
  2. call
 apt-get update && apt-get install software-properties-common
 add-apt-repository ppa:fenics-packages/fenics
 apt update
 apt install fenicsx
 python3 -c "import dolfinx; print(dolfinx.__version__)"

which for me yields:
0.5.2

thanks!
I think finally my problem was that I was trying to import it in my venv, where I have installed my python.

Hi Sara!

Do you solve it? I’m struggling with a similar issue.

Thanks

Hi! In my case, I just ran my programs outside the venv. I still do not know how to “find” them when working in my environment…
Hope it helps,
Sara

Does anyone know how to make this work from inside a conda venv? I apt install’ed on Ubuntu like Sara and ran into the same import issue. It handles the imports when I exit from the venv but wants me to install other packages and I’d like to do that inside the venv (not system-wide). Here’s my error:

aaronm@srv:$ python3 demo_poisson.py 
'pyvista' is required to visualise the solution
Install 'pyvista' with pip: 'python3 -m pip install pyvista'

I can install this package, but again, would not want to make it system-wide, since I’m trying to contain the environment.
Thanks!

If you are using a conda env, I would install both dolfinx and pyvista with conda as shown at https://fenicsproject.org/download/

Gotcha, that worked. Thanks!