Rename conda Python environment

Change Python conda environment old to new by cloning the environment and deleting the original environment, as follows.

conda create --name new --clone old
conda remove --name old --all

Conda environment maintenance

Here are some quick tips for maintaining multiple conda environments.

Switch conda environments

Typically you might have different Python versions installed, or maybe large packages like PyCUDA that require older versions of Numpy, each in their own Python conda environment.

conda env list

shows the environments installed. Pick an environment by name (say, py27) by

conda activate py27

Go back to your main conda environment by

conda deactivate

Disk size

Each conda environment disk size can be checked by listing all environment paths

conda env list

The rest of these steps assume you’re using Linux. Suppose an entry is:

py27 ~/miniconda3/envs/py27

Print the disk size of the py27 environment, which could be several hundred MB or even a couple GB if you have a lot of modules installed:

du -sh ~/miniconda3/envs/py27

To delete an environment:

conda remove --name py27 --all

Notes

reference