How to migrate from conda to pixi
This guide converts a conda project (defined by an environment.yml) into a pixi project. The result: project-local environments, an automatic lockfile, a built-in task runner, and access to the same conda-forge packages.
Prerequisites
- pixi installed (installation instructions)
- An
environment.ymlfile from an existing conda project - Familiarity with conda workflows (see Take Over an Existing Conda Environment if you’re new to conda)
Import into pixi
From the directory containing your environment.yml:
$ pixi init --import environment.yml
✔ Created /path/to/analysis/pixi.toml
If you see Error: × pixi.toml already exists, the directory is already a pixi project. Move to a fresh directory or delete the existing pixi.toml. If you see failed to open file 'environment.yml', run the command from the directory that contains the file.
pixi init also writes a .gitignore (with .pixi/* excluded) and a .gitattributes (so pixi.lock diffs render sensibly). The lockfile itself is generated by pixi install below.
Review the generated pixi.toml
Open pixi.toml. For a typical scientific Python environment.yml (conda-forge channel, a few pinned packages, one pip: entry), the result looks like:
[workspace]
name = "analysis"
channels = ["conda-forge"]
platforms = ["osx-arm64"]
[dependencies]
python = "3.12.*"
pandas = "2.2.*"
matplotlib = "3.9.*"
scikit-learn = "1.5.*"
jupyter = "*"
[pypi-dependencies]
seaborn = "*"Packages from the pip: section in environment.yml land under [pypi-dependencies] and install from PyPI automatically. The platforms field reflects only your current machine; add others if your team uses different operating systems (e.g., platforms = ["osx-arm64", "linux-64"]).
Verify the environment
Install and test that everything works:
$ pixi install
✔ The default environment has been installed.
$ pixi run python -c "import pandas; import sklearn; print('All imports OK')"
All imports OK
If you see Error: × could not find pixi.toml or pyproject.toml, you ran pixi install from outside the project. cd into the directory that contains pixi.toml and try again.
Replace conda habits
The workflow mapping from conda to pixi:
| Conda command | Pixi equivalent | Notes |
|---|---|---|
conda activate analysis |
pixi shell |
Spawns a subshell with the environment active |
conda install scipy |
pixi add scipy |
Adds to pixi.toml and updates the lockfile |
pip install some-pkg |
pixi add --pypi some-pkg |
Tracked in [pypi-dependencies] |
conda env export |
(automatic) | pixi.lock is always up to date |
conda env create -f ... |
pixi install |
Recreates from pixi.toml + pixi.lock |
conda list |
pixi list |
Shows installed packages |
Move Makefile targets into tasks
If your conda project used a Makefile or shell scripts for common operations, move them into pixi.toml:
[tasks]
analyze = "python analyze.py"
test = "pytest"
notebook = "jupyter lab"Run them with pixi run analyze, pixi run test, etc.
Commit pixi.toml and pixi.lock
git add pixi.toml pixi.lockCommit pixi.lock — that’s how teammates get the same resolved environment when they run pixi install. Confirm .pixi/ is in .gitignore; pixi init --import already added it.
Remove the old conda environment
Once the pixi project is working:
conda deactivate
conda env remove -n analysisKeep the environment.yml for a transition period if other team members haven’t switched yet.
Learn more
- When Should I Choose pixi Over uv? for picking the right tool
- uv vs pixi vs conda for Scientific Python for a fuller comparison
- Create Your First Python Project with pixi for pixi fundamentals
- Set Up a GPU Data Science Project with pixi for PyTorch and CUDA workflows
- pixi reference for the full feature set