Using (Ana) conda in PyCharm

I have Pycharm 4 running on my Linux (Ubuntu 14.04). In addition to system python, I also installed Anaconda. It seems that these two songs play together ... PyCharm offers an interesting integration for virtualenv and pip , but the Anaconda Python distribution seems to prefer to use its own conda tool for both actions.

Is there a relatively simple / painless way to use conda in combination with PyCharm? Not only as an alternative interpreter, that is, the PyCharm point in the Anaconda Python binary for the project interpreter, but to be able to create, activate and deactivate virtual envs, add / remove packages in these virtual envs, etc.

Or will I have to choose between using Anaconda (and have a more recent and updated python than can be delivered with the system) and take full advantage of PyCharm's capabilities?

+70
python virtualenv pycharm conda anaconda
Feb 08 '15 at 5:38
source share
5 answers

I know this late, but I thought it would be nice to clarify the situation: PyCharm and Conda and pip work well together.

Short answer

Just control Conda from the command line . PyCharm will automatically notice changes as soon as they happen, as with pip .

Long answer

Create a new Conda environment:

conda create --name foo pandas bokeh

This environment lives under conda_root/envs/foo . Your python interpreter is conda_root/envs/foo/bin/pythonX.X and all of your site packages are in conda_root/envs/foo/lib/pythonX.X/site-packages . This is the same directory structure as in a virtual virtual network. PyCharm does not see the difference.

Now, to activate the new environment from PyCharm, go to file> settings> project> interpreter, select Add locally to the project interpreter field (small gear) and track your python interpreter. Congratulations! Now you have a Conda environment with pandas and bokeh!

Now install some more packages:

conda install scikit-learn

OK ... return to your interpreter in the settings. Magically, PyCharm now sees scikit-learn!

And the opposite is also true , i.e. when you install another package in PyCharm, Conda will automatically notice. Say you set the queries. Now list the Conda packages in your current environment:

conda list

The list now includes queries, and Conda correctly determined (third column) that it was installed using pip.

Conclusion

This is certainly good news for people like me who are trying to get away from pip / virtualenv installation problems when packages are not pure python.

NB: I am running PyCharm pro edition 4.5.3 for Linux. For Windows users, replace the command line in the GUI (and the backslash with a backslash). There are no reasons why it should not work for you.

EDIT: PyCharm5 does not work with Conda support! In the community too.

+97
Aug 11 '15 at 8:53
source share

Change the project interpreter to ~/anaconda2/python/bin by going to File -> Settings -> Project -> Project Interpreter . Also update your launch configuration to use the default Python interpreter via Run -> Edit Configurations . This makes PyCharm use Anaconda instead of the default Python interpreter under usr/bin/python27 .

+19
Mar 01 '16 at 13:41
source share

according to @ cyberbikepunk pycharm's answer has been supporting Anaconda since pycharm5!

See how easy it is to add an environment: enter image description here

+10
Aug 02 '17 at 17:15
source share

Continuum Analytics now provides instructions for setting up Anaconda with various IDEs, including Pycharm here . However, with Pycharm 5.0.1 running on Unbuntu 15.10, Project Interpreter settings were found through File | Settings, and then in the Project branch of the tree in the Settings dialog box.

+6
Dec 29 '15 at 19:33
source share

it can be repeated. I tried to use pycharm to launch the jar - I had anaconda 3, pycharm 2019.1.1 and windows 10. I created a new conda environment - it threw errors. Follow these steps -

  1. Used cmd to install python and flask after creating the environment, as suggested above.

  2. Followed this answer.

  3. As suggested above, go to Run -> Edit Configurations and change the environment there as well as in (2).

Obviously, everywhere was the correct Python interpreter (the one in the environment).

0
Apr 20 '19 at 18:52
source share



All Articles