Having a lot of troubles in Dolfinx usage and installation

If you don’t know why you’ve got fenics components (basix, ufl, ffcx, dolfinx) installed locally at .local/lib/python3.10/site-packages/, then to remove doubt, delete everything in the local installation directory, the entire directory:

rm -rf ~/.local/lib/python3.10/site-packages/

In general, do not use pip to install python packages, since pip does not sufficiently manage the required package versions. Use your package manager only (apt, in the case of Debian/Ubuntu systems)

Sorry for taking a while to answer here, but I don’t know why it started to work, the problem was the directory, I needed to uninstall all python libraries, remove pyenv and then, change the directory from VScode, using ctrl + shift + p, switching to python 3.10 that I installed before. It’s not working in the example of magnetostatics, but it’s not because dolfinx, it’s more because of the missing libraries that I’ll try to install later.

Great that you got it working.