I’m new to FEniCS, and I’m trying to run some sample files I’ve found on the web. I’m using Ubuntu 20.04.1.
The sample program works fine if I do not use a Python virtual environment, but, as soon as I create a venv and I activate it, the terminal cannot recognize fenics as a module (ModuleNotFoundError: No module named ‘fenics’).
Could you elaborate a bit more on what commands works, how you have installed dolfin (and what actually works), and how you are creating a virtual environment and what modules you expect that should be installed in this environment (A virtual environment doesn’t carry over locally installed packages, as far as I am aware).
I copied the sample file poisson.py that I’ve found at this git repository in the following path /home/user/Documents/Python/fenics-venv/my-fenics-project
FEniCS was installed by using the commands for ubuntu found at this link (with the venv activated):
After opening the terminal directly from the folder /home/user/Documents/Python/fenics-venv/my-fenics-project (where the sample file is), I run the following command:
python poisson.py
By doing this, I get the following error:
ModuleNotFoundError: No module named ‘fenics’
While, if I do not create an environment, everything works fine (the sample file run without any problem). It seems to me that FEniCS is not seen by the Python venv, but I was not able to understand why. This could have a trivial answer, since I’m a newbie of Ubuntu and FEniCS, so pardon me in that case.