In the system I work on (Ubuntu), the admin has installed all necessary packages (torch,tensorflow,cuda, matplotlib, etc) in this path:
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
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
My problem is solved.
This solution worked for me:
pyvenv.cfg file in the Virtual environment folder
true and save the change