Anaconda Python: where are the virtual environments stored?
Asked Answered
C

9

94

I am new to Anaconda Python and I am setting up a project in Sublime Text 3. I have installed Anaconda and created a virtual environment using:

conda create -n python27 python=2.7 anaconda
conda create -n python35 python=3.5 anaconda

I am having trouble setting up the Virtualenvs plugin for SublimeText 3.

When I try, it asks me for a virtualenvs path which I give:

~/users/../anaconda/envs/python27

Then it asks for what I'm assuming is a path to a python distribution because it lists file paths for the system versions of python -- but not the anaconda install.

I have no real desire to use the plug in, I just want to be able to use both versions of python. Could I use a project settings file to set the version of python instead?

Carom answered 29/2, 2016 at 20:58 Comment(5)
Did you create conda environments or virtual-environments? For conda environments it's Anaconda_installation_folder/envs/name_of_environment.Burmaburman
I used: 'conda create -n python35 python=3.5 anaconda' to create the env. is that not a virtual environment?Carom
Yes it is, but there are differences if you use virtualenv or conda create. But then the environment should be stored in the above mentioned subfolder of your anaconda installation: ~Anaconda_installation_folder~/envs/python35Burmaburman
sorry to be so dense, but i don't point it to that file path? i need to find a binary file inside the python35 directory? is that the python.app?Carom
sorry, I really don't understand what you are asking. You asked about the path and given you already found python.app it probably exists. Everything else depends on HOW you create build systems but normally you don't need to point at the executable ...Burmaburman
C
151

If you activate the environment you're interested in, you can find that answer in the environment variables.

on MacOS/Linux:

source activate python35
echo $CONDA_PREFIX

on Windows:

conda activate python35
echo %CONDA_PREFIX%

You can also run conda info --envs, and that will show the paths to all your environments.

To get the path to the instance of python being used by a particular environment, do the following:

on MacOS/Linux:

source activate python35
which python

on Windows:

conda activate python35
where python

That should return the path you're looking for.

Councilwoman answered 14/11, 2017 at 3:19 Comment(1)
This appears to be for Mac/Linux, it will not work under Windows.Kerril
S
15

You can run the command conda info.

This will output something like this:

envs directories : C:\Users\Geo\.local\Miniconda3\envs
                   C:\Users\Geo\.conda\envs
                   C:\Users\Geo\AppData\Local\conda\conda\envs

I have installed conda at C:\Users\Geo\.local\Miniconda3.

Then with the command conda info -e you get the location of each environment.

(base) C:\Users\Geo>conda info -e
# conda environments:
#
miniconda2               C:\Users\Geo\.conda\envs\miniconda2
base                  *  C:\Users\Geo\.local\Miniconda3
anaconda3                C:\Users\Geo\.local\Miniconda3\envs\anaconda3
ml                       C:\Users\Geo\.local\Miniconda3\envs\ml
Solemnize answered 1/4, 2019 at 13:20 Comment(1)
Worked with Windows 10!Divergence
A
6

Your environments are located in Anaconda3\envs\<yourEnv_directory>\

Arbitration answered 13/2, 2018 at 18:8 Comment(0)
B
1

To answer your question the folder for your python binaries and packages for the environment are located in ~Anaconda_installation_folder~/envs/python35.

But I cannot really say if that solves your problem. Normally you just switch to your environment source activate python35 and then type python. This will automatically give you the "right" python executable. So if you have a package you could use:

source activate python35
python setup.py install
# Now it is installed in your python35 environment
source activate python27
python setup.py install   
# Now it is also installed in your python27 environment

Just change python setup.py install to what you want to do in the environment. I don't have any experience using Sublime Text and what you mean with build system. But you can always use something like tox which automates a lot of these manual builds.

Burmaburman answered 29/2, 2016 at 21:36 Comment(1)
Nope, they've moved it and hidden it, can't find it now.Valladolid
C
1

None of the other windows solutions worked for me so I'm providing my own. Activate the environment inside anaconda prompt, then issue the command 'where python' and you'll likely see multiple results but one of them, most likely the top one, is the one you're after. For me, my environments were located in AppData\Local... which is not what anyone else had mentioned but the best solution is to use 'where python' which should result in an answer regardless of how you've installed Anaconda.

Cetus answered 9/1, 2019 at 15:14 Comment(0)
T
0

For me, with default anaconda settings and Windows 10, the path that displays after activating the environment is C:\Users\usrname>, but it does not contain an Anaconda3 folder. However, it contains a .conda folder that contains an environments.txt file that lists all conda environments and their locations. By default, the environment folders were stored in:

C:\Users\usrname\AppData\Local\conda\conda\envs\EnvName
Transfuse answered 1/4, 2019 at 12:1 Comment(0)
J
0

None of the above worked. In the end, I found mine at:

c:\Users\myusername\venvs\test1-V7fphpR9\

Jacquenette answered 23/1, 2020 at 15:27 Comment(0)
U
0
  1. Open your c directory
  2. Go to Users and then Open your naming folder (in my case Suman Biswas)
  3. Fiend Anaconda3 folder
  4. Fiend the folder envs in Anaconda3
  5. Now you can see your virtual environment

enter image description here

enter image description here

enter image description here

Uriah answered 14/4, 2020 at 13:35 Comment(0)
K
-2

On Windows 10 x64 and Anaconda3, the python interpreter for a newly created environment "my_env" would appear here:

C:\ProgramData\Anaconda3\envs\my_env\python.exe

Or here:

C:\Users\[username]\AppData\Local\conda\conda\envs\my_env

Check both places.


Update 2020-07-17

  • If Anaconda is installed as Administrator, then the default is one location.
  • If Anaconda is not installed as Administrator, then it appears in a different location.
Kerril answered 2/1, 2019 at 19:51 Comment(2)
That is not even a directoryArbitration
@JasonAngel It depends on whether or not Anaconda is is installed as an Administrator or not. Updated the answer.Kerril

© 2022 - 2024 — McMap. All rights reserved.