What's the difference between virtual environment and existing interpreter in PyCharm?

Answered

I opened PyCharm for the first time, and I see an option to choose 'New environment using: Virtualenv / Conda' or 'Existing interpreter'.

So:

1) What's the difference between the 2?

2) What's the difference between Virtualenv and Conda?

 

Thanks!

5 comments
Comment actions Permalink

Hello,

1.Pycharm detects existing python environments on your system and shows them in the Existing Environment| Interpreter drop-down list. If your existing environment is not detected automatically, you could press cogwheel and navigate to its path manually.

For more info please check https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html and feel free to ask any questions.

2. Please check https://conda.io/docs/user-guide/install/download.html. To know more about conda environments please take a look at https://conda.io/docs/user-guide/concepts.html#conda-environments.

 

-4
Comment actions Permalink

Sorry I don't understand. I have 3 options: Virtualenv / Conda / Existing Interpreter. In Virtualenv and Existing Interpreter I can choose the Python.exe file in Anaconda's directory (I have Anconda 3 installed). So what's the difference here? And if I choose Conda environment with the same Python version, does it make this choice any different?

The code runs successfully in all 3 options... So I don't understand what's the difference and what's the best choice for me.

Thanks

1
Comment actions Permalink

> In Virtualenv and Existing Interpreter I can choose the Python.exe file in Anaconda's directory (I have Anconda 3 installed). So what's the difference here?

Difference is that if you use virtualenv for the project and add/remove packages it affects only virtual environment. If you use Existing Interpreter then  all changes will affect system wide interpreter and these changes will be available in all projects that use that interpreter

> And if I choose Conda environment with the same Python version, does it make this choice any different?

When you create conda interpterer it asks for base interpreter it will use to create environment. Generally it checks for packages that should be imported in new environment.

Long story short:

Existing interpreter  - all changes are system wide

Conda/Virtual interpreter - uses selected interpreter as initial source, but creates independent copy which could be modified fot project needs.

 

 

 

2
Comment actions Permalink

Yaroslav Bedrov you say that Pycharm detect existing python installs, does this ability extend to venvs in the project directory ?

perhaps in a venv folder ?

We clone and create the projects directory from a script and thus the virtualenv is already there just needs setting each time we create an environment.

0
Comment actions Permalink

>you say that Pycharm detect existing python installs, does this ability extend to venvs in the project directory ?

Yes, it does. If it doesn't work, you can always select "Virtulaenv > Existing environment" and point manually to `venv/bin/python` (for Linux)

0

Please sign in to leave a comment.