In the system I work on (Ubuntu), the admin has installed all necessary packages (torch,tensorflow,cuda, matplotlib, etc) in this path:
/usr/bin/python3.10
If I check "inherit global site-packages" I can access all necessary packages. I want to know how to create a virtual env based on this interpreter to run Jupiter Notebook?
I don't want to use Pycharm's Jupyter capability. I want to use Jupyter notebook independently and use this venv.
To create a new virtual env I've done these steps:
virtualenv -p /usr/bin/python3.10 MY-env
source ./MY-env/bin/activate
And then to add my venv to jupyter kernels:
pip install ipykernel
python -m ipykernel install --user --name=MY-env
In the Terminal when I run jupyter-lab, I select My-env from the "Change Kernel" option. for testing I imported torch, but I got the error:
ModuleNotFoundError: No module named 'torch'
While torch is installed and exists in the site-packages. It means it hasn't detected site-packages of /usr/bin/python3.10
.