How can I rename a conda environment? How can I rename a conda environment? python python

How can I rename a conda environment?


You can't.

One workaround is to create clone a new environment and then remove the original one.

First, remember to deactivate your current environment. You can do this with the commands:

  • deactivate on Windows or
  • source deactivate on macOS/Linux.

Then:

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

Notice 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.


conda create --name new_name --copy --clone old_name is better

I use conda create --name new_name --clone old_name which is without --copybut encountered pip breaks...

the following url may helpInstalling tensorflow in cloned conda environment breaks conda environment it was cloned from


Based upon dwanderson's helpful comment, I was able to do this in a Bash one-liner:

conda create --name envpython2 --file <(conda list -n env1 -e )

My badly named env was "env1" and the new one I wish to clone from it is "envpython2".