How to Move Conda Environment

Activate the conda environment that you want to move. Then, enter the following command:

1
2
conda activate C:\Users\YourUserName\.conda\envs\YourEnvironmentName
conda env export > C:\Users\YourUserName\YourEnvironmentName.yml

This will create a YAML file that contains the environment’s dependencies.
After that, deactivate the environment, and then remove the environment by the following command:

1
conda remove --prefix C:\Users\YourUserName\.conda\envs\YourEnvironmentName --all

Finally, create a new environment by the following command:

1
2
conda env create -p E:\ProgramData\Miniconda3\envs\YourNewEnvironmentName -f C:\Users\YourUserName\YourEnvironmentName.yml
del C:\Users\YourUserName\YourEnvironmentName.yml

Delete the YAML file after creating the new environment. Done!




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • How to Solve Missing Credentials
  • How to Setup VS Code