PyCharm is probably one of the most popular IDE for Python developers.

There are two main versions: Community (Free) and Professional.

In case you are using Anaconda Python distribution for some projects, you already know that conda virtual environment is not applied correctly in terminal window of the PyCharm.

tt@tt-Ubuntu1804LTS:~>which python

As can be seen, python interpreter points to the system interpreter, not a virtual one, which is wrong.

The easiest way to solve that bug is to check which virtual environments are already created:

tt@tt-Ubuntu1804LTS:~> conda env list 
# conda environments:
base                  *  /home/tt/anaconda3
test               	     /home/tt/anaconda3/envs/test

After that you can manually activate the same environment that is already activated in Python console and code editor by executing the following command:

tt@tt-Ubuntu1804LTS:~>conda activate test
(test) tt@tt-Ubuntu1804LTS:~>

Now we have correct conda virtual environment inside PyCharm integrated terminal active.

Default Python interpreter with pipenv or virtualenv virtualization works as expected:

(venv) tt@tt-Ubuntu1804LTS:~/Documents/project001>which python

Bug is expected to be resolved in the next quarter update.

Till then you can use proposed solution as a temporal fix.

Get notified when a new post is published!



There are no comments yet. Why not start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.