Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to activate an Anaconda environment

I'm on Windows 8, using Anaconda 1.7.5 64bit.

I created a new Anaconda environment with

conda create -p ./test python=2.7 pip

from C:\Pr\TEMP\venv\.

This worked well (there is a folder with a new python distribution). conda tells me to type

activate C:\PR\TEMP\venv\test

to activate the environment, however this returns:

No environment named "C:\PR\temp\venv\test" exists in C:\PR\Anaconda\envs

How can I activate the environment? What am I doing wrong?

like image 820
pandita Avatar asked Nov 19 '13 20:11

pandita


People also ask

How do you activate and deactivate Anaconda environment?

You can always use conda activate or conda deactivate to switch between your environments. You can directly activate the environment you wish to use by using conda activate . conda deactivate will deactivate your current active environment and change to the default environment which is the base environment.

How do I know if my conda environment is activated?

When a conda environment is activated, it will export following related environment variables: $CONDA_DEFAULT_ENV , name of current activated env. $CONDA_PREFIX , path to the current activate env.


2 Answers

Use cmd instead of Powershell! I spent 2 hours before I switched to cmd and then it worked!

create Environment:

conda create -n your_environment_name 

see list of conda environments:

conda env list 

activate your environment:

conda activate your_environment_name 

That's all folks

like image 30
Ilia Chigogidze Avatar answered Oct 13 '22 10:10

Ilia Chigogidze


If this happens you would need to set the PATH for your environment (so that it gets the right Python from the environment and Scripts\ on Windows).

Imagine you have created an environment called py33 by using:

conda create -n py33 python=3.3 anaconda 

Here the folders are created by default in Anaconda\envs, so you need to set the PATH as:

set PATH=C:\Anaconda\envs\py33\Scripts;C:\Anaconda\envs\py33;%PATH% 

Now it should work in the command window:

activate py33 

The line above is the Windows equivalent to the code that normally appears in the tutorials for Mac and Linux:

$ source activate py33 

More info: https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/8T8i11gO39U

Does `anaconda` create a separate PYTHONPATH variable for each new environment?

like image 101
FZNB Avatar answered Oct 13 '22 10:10

FZNB