How to rename a conda environment using (micro)mamba?

1.1k views Asked by At

I now use micromamba instead of conda or mamba. I would like to rename/move an environment.

Using conda, I can rename via:

conda rename -n CURRENT_ENV_NAME NEW_ENV_NAME

But this doesn't work with neither mamba nor micromamba:

$ /opt/homebrew/Caskroom/miniforge/base/condabin/mamba rename -n flu_frequencies_test flu_frequencies
Currently, only install, create, list, search, run, info, clean, remove, update, repoquery, activate and deactivate are supported through mamba.

$ micromamba rename -n flu_frequencies_test flu_frequencies
The following arguments were not expected: flu_frequencies rename
Run with --help for more information.
1

There are 1 answers

0
maddes8cht On

As your errormessage says, Currently, only install, create, list, search, run, info, clean, remove, update, repoquery, activate and deactivate are supported through mamba. The documentation on the quickstart of micromamba tells you as well:

micromamba supports a subset of all mamba or conda commands and implements a command line interface from scratch. You can see all implemented commands with micromamba --help:

Even with a mambaforge installation, only these commands work with the mamba command, while in the mambaforge variant there is a conda command available filling these gaps.

Your only chance is to make a copy of your environment with your chosen target name and then delete the old one:

It should work with

micromamba create --name new_environment_name --clone old_environment_name

Then you can remove the old on with

micromamba env remove --name old_environment_name

You will however not get changes in your environment installed by pip or the like.

Maybe some time the missing commands get also implemented in mamba, but not at this point in time.