Warm tip: This article is reproduced from stackoverflow.com, please click
Anaconda conda python

How can I rename a conda environment?

发布于 2020-04-11 11:47:31

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

Questioner
pkowalczyk
Viewed
166
pkowalczyk 2017-07-14 08:12

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.