then how to install the dolfinx?I have installed dolfinx by using sudo apt install fenicsx on my ubuntu terminal, but after I open this new project, the import still has errors, and I don’t know how to install dolfinx on the virtual environment
You can try what I did: after installing fenicsx to the system python via apt,
create your project’s virtual environment with the --system-site-packages option to reference the system packages:
python3 -m venv venv312 --system-site-packages
Now you use dolfinx from within the venv and install additional packages (pyvista, etc.) into it if you wish to avoid mucking around further with the system environment.
In my experience, the first step is to enable WSL, then install Ubuntu. After creating an account and exiting, move Ubuntu to the desired drive, and then open Ubuntu to install FEniCS. I did not use Docker; I installed it directly.
After that, you can open PyCharm and connect to the installed FEniCS via WSL. Note that before actually using it, you need to activate FEniCS.