How can I rename a conda environment?

pkowalczyk picture pkowalczyk · Feb 14, 2017 · Viewed 137.6k times · Source

I have a conda environment named old_name, how can I change its name to new_name without breaking references?

Answer

pkowalczyk picture pkowalczyk · Feb 14, 2017

You can't.

One workaround is to create clone environment, and then remove original one:

(remember about deactivating current environment with deactivate on Windows and source deactivate on macOS/Linux)

conda create --name new_name --clone old_name
conda remove --name old_name --all # or its alias: `conda env remove --name old_name`

There are several drawbacks of this method:

  1. it redownloads packages - you can use --offline flag to disable it,
  2. time consumed on copying environment's files,
  3. temporary double disk usage.

There is an open issue requesting this feature.