micromamba create is the command you will use most. This guide covers every common pattern: named environments, path environments, environment files, pinned versions and exporting your work.
The basic command
micromamba create -n api python=3.12 fastapi uvicorn -c conda-forge
-n apinames the environment.- The package list follows; versions use conda match specs such as
python=3.12. -c conda-forgechooses the channel (not needed if it is already in your config).
Micromamba solves the dependencies, shows the transaction and asks for confirmation. Add -y to accept automatically.
Path-based environments
Use -p to keep an environment inside the project folder:
micromamba create -p ./env python=3.11 pytest
micromamba run -p ./env pytest
This is handy in CI and for projects you want to delete in one go.
Creating from environment.yml
A shared environment file is the best way to make projects reproducible:
name: analysis
channels:
- conda-forge
dependencies:
- python=3.12
- pandas
- matplotlib
- pip
- pip:
- some-pypi-only-package
micromamba create -f environment.yml
micromamba activate analysis
Micromamba can install pip dependencies listed under pip: when pip is part of the environment.
Pinning versions
| Spec | Meaning |
|---|---|
numpy | Any version the solver picks |
numpy=1.26 | Any 1.26.x release |
"numpy>=2,<3" | A range (quote it in the shell) |
numpy==2.1.0 | Exactly this version |
Adding packages later
micromamba install -n analysis seaborn
micromamba update -n analysis --all
To apply changes from an edited file to an existing environment, use micromamba install -n analysis -f environment.yml.
Exporting and sharing
# readable file for teammates
micromamba env export -n analysis > environment.yml
# exact package list for the same platform
micromamba env export -n analysis --explicit > explicit.txt
The explicit export lists exact package URLs, which is useful for repeatable builds on the same platform.
Tips for faster, cleaner environments
- Use conda-forge with strict channel priority instead of mixing channels.
- Create the environment with all packages at once; it gives the solver the full picture.
- Keep environments small and project-specific rather than one huge shared one.
- Clean caches occasionally with
micromamba clean --all.
Lockfiles for exact rebuilds
Environment files describe what you want; lockfiles record exactly what was installed. Micromamba can create environments from explicit package lists produced by env export --explicit, and it understands conda-lock style lockfiles, which many teams generate in CI. Use lockfiles when two machines must have byte-identical environments, and environment.yml files when you want readable, flexible specifications.
Creating environments for another platform
The --platform option lets you resolve an environment for a different system, for example preparing a Linux environment on a Mac:
micromamba create -n linux-test --platform linux-64 python=3.12 --dry-run
Use --dry-run to check that the solve succeeds without installing packages you cannot run locally.
Common create errors
| Message | What to do |
|---|---|
| Could not solve for environment specs | Loosen version pins one at a time, and make sure all packages come from conda-forge. |
| Package not found | Check the channel; some packages exist only on PyPI and belong under pip:. |
| Environment already exists | Remove it first or choose a different name with -n. |
Related guides
Remove environments you no longer need with our delete guide, or compare workflows in Micromamba vs conda.