Paul Morozov
Paul Morozov

Reputation: 153

How to use Anaconda base environment in Pycharm?

I am trying to set up base environment of Anaconda to use in PyCharm. There is no such option in the settings (either "system interpreter" or "create new environment"; I had to use "system interpreter"). I managed to setup "activate.bat" for the terminal, but "base" environment is not activated during debug or usual runs - as a result I get errors (compared to just run in Anaconda console - everything is fine). What should I do?

Upvotes: 14

Views: 14418

Answers (8)

aafsar
aafsar

Reputation: 1

I would also like to add that you might prefer to clone the base first and use the cloned virtual environment, so that you can update/install packages without worrying to break some dependencies etc. Incidentally this is also an easier way to use the full package compared to setting up the base environment.

In your prompt/terminal, you can use the following command (per instructions in this post):

conda create --name <env_name> --clone base

where instead of <env_name> you write the desired name for your environment.

Then you can use the newly cloned environment, which will include all the packages from your anaconda, by following the instructions in the "Configuring a PyCharm Project with an existing conda environment" section in the official page.

Upvotes: 0

sampath
sampath

Reputation: 1

I have a system interpreter option and point it to anaconda base python.exe file

screenshot

Upvotes: 0

Abhijith
Abhijith

Reputation: 124

I tried selecting the 'python.exe' file in the main Anaconda installation directory as selecting bin folder did not work for me.

This one gave me the base env :

'..\Programs\Anaconda\python.exe'

Please note that I have installed Anaconda in Programs folder instead of the default 'C:\Users\ .. ' directory during installation. You should look for the .exe file in the location where you have installed Anaconda.

Python version 3.8 and Pycharm 2021.1 community edition.

Upvotes: 0

Foxy Fox
Foxy Fox

Reputation: 491

Windows Solution:

Go to File -> Settings -> Python Interpreter -> Add (Gear symbol) -> VirtualEnv Environment -> Exisiting Environment (C:...\Anaconda3\python.exe)

This sequence will create the Python (base) Interpreter.

Upvotes: 2

Gunjan Paul
Gunjan Paul

Reputation: 531

I am using macOS and I have got the base python environment in the following location

/opt/anaconda3/bin/python3

Just add in the location in the interpreter section under existing environment option

Upvotes: 0

donjpierce
donjpierce

Reputation: 41

I'm a Mac OS user (Catalina).

I found my Conda base environment here: /Users/donald/anaconda3/bin/python3

Fortunately pip3 and Conda (base) work together pretty seamlessly with this setup. So this environment should show up as "Python 3.8 (base)" (or similar) separate from your other Conda environments.

Mac OS New Project Interpreter Setup

Upvotes: 3

Santiago H
Santiago H

Reputation: 81

I'm Linux user.

Before use anaconda in PyCharm i installed anaconda like anaconda web site says:

https://docs.anaconda.com/anaconda/install/

Later i tried to use it in PyCharm in the anaconda environment option but it installed everything again even though anaconda was already installed on mi PC.

I solved that selecting a "Pure Pyhton" project, "Existing interpreter" and in "Interpreter" add the python executable from the anaconda installation. The picture is an example of my project configuration.

Anaconda Project

Upvotes: 1

Pavel Karateev
Pavel Karateev

Reputation: 8495

You need to select python.exe from the base Anaconda, e.g.

enter image description here

It's also a better choice to use 2019.1 EAP build, as there's a fix to conda activation in the terminal there. You don't really need to select activate.bat as a terminal.

Upvotes: 12

Related Questions