29

My conda version is 4.7.11. I am trying to clone the base env to a new one so I can install some specific packages and will not mess up the base environment. I tried as some other answers suggested:

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

and

conda create --name <myenv> --clone root

But none of them works. The message from terminal is "The system cannot find the file specified".

Below is my cuurent env list:

base                  *  D:\LabTest\Dave\Anaconda
dlc-windowsCPU           D:\LabTest\Dave\Anaconda\envs\dlc-windowsCPU
dlc-windowsGPU           D:\LabTest\Dave\Anaconda\envs\dlc-windowsGPU
dlc-windowsGPU-dave      D:\LabTest\Dave\Anaconda\envs\dlc-windowsGPU-dave
dlc-windowsGPU-yc        D:\LabTest\Dave\Anaconda\envs\dlc-windowsGPU-yc

I also cannot clone from my anaconda navigator.

Don't know what to do.

Eric
  • 327
  • 1
  • 3
  • 9

3 Answers3

36

You just have to refer to the base environment, which is called base and not root:

conda create --name <myenv> --clone base
MRK
  • 546
  • 4
  • 6
  • 5
    OP specifically said in the original question that that's the first thing he tried. Should work normally, but didn't. – fantabolous Nov 21 '20 at 05:49
26

I would recommend that you try the method as shown on this official documentation. In summary, you can get all the list of modules installed in the virtual environment, save it as a .txt file, and create a new environment from that .txt file. For example,

conda list --explicit > spec-file.txt

Then, create a new environment using that specification.

conda create --name myenv --file spec-file.txt

While this is not exactly "cloning" the base environment, you should be able to reproduce a virtual environment identical to the base through this process.

Jake Tae
  • 1,681
  • 1
  • 8
  • 11
6

What I usually do when creating new env is the below command:

conda create --clone pytorch --name pytorch1.6

Where pytorch is the environment that I am cloning to pytorch1.6 which I'll be updating to the latest nightly build. My reason for cloning is to avoid configuration of Cuda all over again :) Documentation or rather official cheatsheet lives here

jackal
  • 115
  • 2
  • 10