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.
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.
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.
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>
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.
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,
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.
You just have to refer to the base environment, which is called base
and not root
:
conda create --name <myenv> --clone base
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With