Reputation: 89
I am using PyCharm Community 2022.1 on a Linux machine. I use a Virtual Environment (venv) for my project and I'm struggling to understand how it works.
I can install packages via the PyCharm IDE, except when the package is too large I get an error:
I follow the suggestion of:
source /home/robin/PycharmProjects/ChickenRun2/venv/bin/activate
pip install torch
I get the error:
After typing:
python -m ensure pip
python -m pip install --upgrade pip
pip install torch
I can install the "torch" package in the venv, however the package does not seem to be installed according to the PyCharm IDE.
I also notice something strange - the version of python according to PyCharm is:
While from the command line the python version is:
I have set the Project Interpreter under "File > Settings > Project" in PyCharm to use Base Interpreter /usr/bin/python when setting up the venv, and that is definitely python 3.10.4
However, within the IDE it is listed as Python 3.9:
While from the terminal it is shown as Python 3.10.4:
Does anyone know what is going on here? Or have a suggestion on how I can get the torch package installed so I can use it in PyCharm?
Upvotes: 0
Views: 439
Reputation: 89
I resolved the problem of installing the torch package by using the Terminal tab at the bottom of the PyCharm IDE.
(venv) pip install --no-cache-dir torch
I'm still confused why it is using Python 3.9 rather than Python 3.10 when Base Interpreter is /usr/bin/python which is Python 3.10.
Also I don't understand why the same thing does not work from the terminal:
source /home/robin/PycharmProjects/ChickenRun2/venv/bin/activate
pip install --no-cache-dir torch
It does not recognise pip.
But the main issue is resolved!
Upvotes: 0