Help installing Fenics

I am having a lot of difficulty getting Fenicsx (or rather dolfinx for python) to install and run smoothly (at all).

I am on Ubuntu derived PopOS (22.04) and I would like to install and use fenicsx in a conda environment if at all possible.

I first tried following the instructions from the main landing page which led me to However when I try to run any demos from I get the following error

TypeError: function() argument 'code' must be code, not str

which derives from the following import line

from dolfinx.fem.function import FunctionSpace

Similar issues have been highlighted in these community questions and, but there are no clear answers in these.

As an alternative I tried installing it using my package manager using the instructions When I attempt to run the demo scripts I get the same error.

Does anyone have any suggestion as to how to get this working?

P.S. Apologies for the bodged links - the system restricts me from posting them properly as I am a new user.