skip to Main Content

I’m able to use python3 and venv with other editors like emacs and nano, but for some reason PyCharm seems to choke on an existing environment.

I’m using Debian 12, and I have PyCharm Community install via Flatpack. My system python is 3.11.2, and I created the virtual environment with python3 -m venv venv. Then I install my packages with pip, write code in some other editor, run it in the terminal, and it all works fine.

When I go to open the project in PyCharm however, it flags all my imports like "no module named matplotlib". When I try to configure the interpreter in File->Settings it says it’s pointing to home/user/Projects/test_a/venv/bin/python, which seems correct, but it also says "Python packaging tools not found", and then I get an error modal saying:

Executed command:
/home/user/Projects/test_a/venv/bin/python
/app/pycharm/plugins/pyton-ce/helpers/packaging_tool.py list

Error: Python packaging tool 'setuptools' not found

When I check my pip list, both at the system level and in the venv, setuptools is listed.
This does not happen if I create a new project in PyCharm and let it create the venv.

Any ideas on how I can get PyCharm to work existing virtual environments?

2

Answers


  1. Suggestions:

    I think there are hardcoded paths in ‘<your-venv>/bin/activate.sh’ that might interfere with things working properly in other contexts.

    If you want to use PyCharm, try and create the venv from within PyCharm. While you do that, please check the default directory paths suggested, because PyCharm seems to be keen on using the default ‘PyCharmProjects’. Sometimes, this leads to things being installed in the wrong place.

    Login or Signup to reply.
  2. The issue that you are having is flatpak’s fault. I had the same. If you install pycharm from the official Website you will not face this issue. At least that was the case on my debian 12 machine.

    Installing via ToolBox -> for me the best option

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search