Installing fenics using Spack on Ubuntu 22.04LTS

Hi Everyone,

very new to fenics but I am trying to get it running on my ubuntu 22.04 machine. I installed it successfully using spack, following this link: dolfinx/README.md at main · FEniCS/dolfinx · GitHub

Once installed I tried running the poisson test script in python but get following error when trying to import fenics package: ImportError: cannot import name ‘sub_forms_by_domain’ from ‘ufl.form’

Any clue why? Do I have to link the packages somehow?
Sorry just not very familiar with is!

See: Ubuntu 18.04 - ImportError: cannot import name 'sub_forms_by_domain' - #2 by LiborKudela

Do you already have another version of ufl installed on your system?

I did “pip install fenics” beforehand. Before that I had reinstalled ubuntu 22.04LTS fresh so there was nothing on there apart from the applications that come with the distribution.

Let me answer my won question: The solution in the link you provided worked like a charm. Just removed the ufl folder in: ~/.local/lib/python3.10/site-packages and everything running!