How to install dolfinx on my virtual environment of my pycharm project

when I first create this pycharm project, I choose this as my set up environment(the project location is /home/a/Desktop/FluidSIX/FluidSIX)


after I create a first python file, I choose the python interpreter as

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

If you use apt for installation, you should use the system Python, not a additional virtual env.

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.

1 Like

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.