flathub / com.jetbrains.PyCharm-Community

https://flathub.org/apps/details/com.jetbrains.PyCharm-Community
11 stars 10 forks source link

Python3.9 as only Python3 #151

Open Rastopapola opened 2 years ago

Rastopapola commented 2 years ago

Hi everyone!

I'm using this flatpak package on my main computer and wanted to install the latest version on my laptop as well. Strangely, on the newer version there seems to be an issue with the python3 venvs.

Details

  1. python3 is installed as python3.7 as default
  2. Creating a python3 venv directly in pycharm creates a python3.9 venv, despite the fact that python version is not installed, not even available for my system (Debian10)
    1. Yes, running python -V in the pycharm terminal gives me a 3.9.x version
    2. Strangely, opening this venv using via shell with source venv/bin/activate and asking for the python version gives the expected 3.7.x output
  3. Creating a venv from the shell like python3 -m venv/ correctly creates the python3.7 venv, but adding this venv to pycharm's environment list results in an error message about having a misconfigured SDK. However the messages can be skipped and pycharm still acts as the venv would be a python3.9 venv, which it's obviously not

Could this be related to the freedesktop.sdk project, which is a dependency of this pycharm package?

emeric254 commented 1 year ago

Hi, when you run inside the flatpak you are accessing the python that is available / installed inside it. In your case python 3.9, it's independant from your system (that's the purpose of flatpak :wink:)

So on my side when i need to run a project both inside and outside pycharm, I create two venv : one called venv from and for my system, and one called venv-pycharm from and for pycharm .

An other solution would be to try to use '--copies' instead of the default '--symlinks' when creating the venv (as mentionned here in the doc https://docs.python.org/3/library/venv.html#creating-virtual-environments)