Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clone base environment in anaconda

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.

like image 378
Eric Avatar asked Feb 05 '20 00:02

Eric


People also ask

What is base environment in Anaconda?

Conda has a default environment called base that include a Python installation and some core system libraries and dependencies of Conda. It is a “best practice” to avoid installing additional packages into your base software environment.

How do I change the base environment in Anaconda?

Go to the start menu, right-click 'Anaconda Prompt' and go to file location. Open its properties & change the target to the location of your preferred environment.

How do I create a clone of a Conda environment?

On installation, conda creates a base environment. However, you can also create your own base environment with packages you frequently use. The - -clone option will create a clone (or snapshot) of the environment, <span>conda create --name snapshot --clone myenv</span>

How do I create an environment in Anaconda?

Use the terminal or an Anaconda Prompt for the following steps: Create the environment from the environment.yml file: conda env create -f environment.yml. The first line of the yml file sets the new environment's name. For details see Creating an environment file manually.

How do I preserve and move an environment in conda?

Conda provides a number of ways to preserve and move environments. On installation, conda creates a base environment. However, you can also create your own base environment with packages you frequently use. The - -clone option will create a clone (or snapshot) of the environment,

How do I use PIP in an anaconda environment?

To use pip in your environment, in your terminal window or an Anaconda Prompt, run: Issues may arise when using pip and conda together. When combining conda and pip, it is best to use an isolated conda environment. Only after conda has been used to install as many packages as possible should pip be used to install any remaining software.


3 Answers

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

conda create --name <myenv> --clone base
like image 182
MRK Avatar answered Oct 24 '22 08:10

MRK


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.

like image 31
Jake Tae Avatar answered Oct 24 '22 08:10

Jake Tae


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

like image 5
jackal Avatar answered Oct 24 '22 07:10

jackal