How can I rename a conda environment?

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

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.

From: stackoverflow.com/q/42231764

Back to homepage or read more recommendations: