pythonmambamicromamba

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


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.

Solution

  • Micromamba

    As stated in the answer to Cloning environment with micromamba, --clone is not an option in micromamba.

    Instead, export the environment yaml and create a new environment using the --file flag. Then remove the old environment.

    1. export the env dependencies: micromamba env export oldenv > oldenv.yaml
    2. create a new env with a new name: micromamba create -n newenv --file oldenv.yaml
    3. remove the old env: micromamba env remove -n oldenv
    4. delete the yaml file: rm oldenv.yaml