How to bring all conda environments into one folder

I am on WIN10 with conda version 4.3.23 and Command line client (version 1.6.0).

I would like to activate environment new36, but before activating an environment conda info --envs gives:

(C:\Users\Myself\Anaconda3) C:\Users\Myself>conda info --envs
# conda environments:
blender35                C:\Users\Myself\Anaconda3\envs\blender35
django                   C:\Users\Myself\Anaconda3\envs\django
ntl                      C:\Users\Myself\Anaconda3\envs\ntl
python26                 C:\Users\Myself\Anaconda3\envs\python26
python27                 C:\Users\Myself\Anaconda3\envs\python27
python35                 C:\Users\Myself\Anaconda3\envs\python35
python36                 C:\Users\Myself\Anaconda3\envs\python36
webdev                   C:\Users\Myself\Anaconda3\envs\webdev
root                  *  C:\Users\Myself\Anaconda3

Search path seems to be C:\Users\Myself\Anaconda3\envs and after activating e.g. python36 conda info --envs gives:

(python36) C:\Users\Myself>conda info --envs
# conda environments:
new36                    C:\Anaconda3\envs\dggs36
django                   C:\Anaconda3\envs\django
python26                 C:\Anaconda3\envs\python26
python27                 C:\Anaconda3\envs\python27
python35                 C:\Anaconda3\envs\python35
python36              *  C:\Anaconda3\envs\python36
webdev                   C:\Anaconda3\envs\webdev
root                     C:\Anaconda3

Now blender35 and ntl disappeared and cannot be activated while new36 shows up and can be activated; the search path seems to be C:\Anaconda3\envs\.

Question: How can I move all environments to one folder (and one search path)? I would like to have everything in C:\Anaconda3\envs\

My guess is that something got mixed up between conda and anaconda but I do not know which files to check to solve this problem.

Additionally, I found the .condarc file at C:\Users\Myself

ssl_verify: 'True'
  - anaconda-fusion
  - defaults
  - conda-forge
show_channel_urls: true
channel_priority: true

Edit 1: The user guide about managing environments actually says

TIP: In Windows, it is good practice to deactivate one environment before activating another.

Following this tip, I would not even be able to activate new36

1 answer

  • answered 2018-02-13 02:57 alvits


    You can't just move the directories from one location to another. All the scripts within an environment have references to the environment's path as listed by conda info --envs.

    Solution Summary

    However, you can recreate the same environment from one path to the other path. In summary you will need to gather environment information from old path, re-create environment in new path, delete the old environment, and finally delete the old root when all environments have been re-created.

    Assumptions made

    Old path: c:\Users\Myself\Anaconda3
    New Path: C:\Anaconda3

    Gather environment information

    List all packages of an environment and save it to a file.

    c:\Users\Myself\Anaconda3\bin\conda list -n ntl > c:\temp\ntl.txt
    c:\Users\Myself\Anaconda3\bin\conda list -n blender35 > c:\temp\blender36.txt

    Use the information in the file to create new environment

    Note: The file will contain package name, version and build channel. For packages where build channel is <pip>, use pip to install.

    Use package information from c:\temp\ntl.txt here

    C:\Anaconda3\bin\conda create -n ntl packagename==version packagename2==version ...

    Use package information from c:\temp\blender35.txt here

    C:\Anaconda3\bin\conda create -n blender35 packagename==version packagename2==version ...

    Delete old path

    We'll take the shortcut here. Drop the old path. There really is no need to drop environments individually.

    del /S c:\Users\Myself\Anaconda3

    Hope this helps.