How Do I Delete a Micromamba Environment?

Delete Micromamba environments safely with env remove, by name or path, clean the package cache, and recover disk space.

Illustration of two environment boxes with one crossed out
Illustration created for this guide

Environments are cheap to create, so they pile up quickly. This guide shows how to remove a Micromamba environment cleanly, how to handle path-based environments, and how to recover the disk space used by cached packages.

Step 1: List your environments

micromamba env list

The output shows every environment Micromamba knows about with its full path. Named environments live in envs/ under your root prefix, for example ~/micromamba/envs/old-project.

Step 2: Deactivate it

You cannot reliably remove the environment you are currently inside. If your prompt shows its name, leave it first:

micromamba deactivate

Step 3: Remove the environment

By name:

micromamba env remove -n old-project

By path, for environments created with -p:

micromamba env remove -p ./.conda-env

Micromamba lists what will be removed and asks for confirmation. Add -y to skip the prompt in scripts.

Before deleting: if you might need the environment again, export it first with micromamba env export -n old-project > old-project.yml. Recreating from a file is much easier than remembering versions.

Removing packages instead of the whole environment

If you only want to drop one library, keep the environment and uninstall the package:

micromamba remove -n old-project requests

Micromamba also removes dependencies that are no longer needed by anything else.

Step 4: Free disk space

Removing an environment does not delete the downloaded package files kept in the shared package cache. They let future installs reuse files instead of downloading again. To clean them:

micromamba clean --all

Run micromamba info to see where the package cache lives on your system.

What about deleting the folder by hand?

Deleting the environment folder directly usually works, but the command is safer: it runs package removal steps and avoids leaving stale entries behind. If an environment folder is already gone but still appears in lists, check the envs folder under the root prefix and any custom paths you used.

Removing many environments

A short shell loop removes several environments at once:

for env in test1 test2 test3; do
  micromamba env remove -n "$env" -y
done

Quick reference

GoalCommand
List environmentsmicromamba env list
Delete by namemicromamba env remove -n NAME
Delete by pathmicromamba env remove -p PATH
Remove one packagemicromamba remove -n NAME PACKAGE
Clean cachesmicromamba clean --all
Back up firstmicromamba env export -n NAME > NAME.yml

When removal fails

On Windows, removal can fail if a program still has files open inside the environment: a running Python process, a Jupyter kernel, or an editor such as VS Code using its interpreter. Close those programs, then run the command again. On Linux and macOS, check for processes with ps aux | grep envs/NAME.

If you see permission errors, make sure you are deleting an environment you own. Environments created by another user or with sudo need to be removed by that account.

How much space will I get back?

Micromamba uses hard links from the package cache where possible, so one environment may not take as much space as its folder size suggests, and removing it alone can free less than expected. The full space comes back after micromamba clean --all removes cached packages that no environment still uses. Check usage before and after with du -sh ~/micromamba on Linux and macOS.

Recreating an environment later

If you exported the environment before deleting it, rebuilding is one command:

micromamba create -f old-project.yml

Package versions may change slightly if the file does not pin them. For a byte-for-byte rebuild on the same platform, export with --explicit before removing.

Related guides

Want to remove Micromamba itself? See how to uninstall Micromamba. Not sure where your environments are stored? Read where Micromamba is installed.

Download Micromamba 2.10.0

Official install scripts (main.zip) from GitHub, BSD-3-Clause. The download starts on this page.

Download