This guide helps existing PyPhi developers migrate from conda-based workflows to uv.
- 3-10x faster installation and dependency resolution
- Better reproducibility with deterministic lockfiles (
uv.lock) - Simpler workflow - one modern tool instead of conda+pip hybrid
- All dependencies available - Graphillion, igraph, and pyemd all have pre-built wheels
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"cd /path/to/pyphi
# Create virtual environment
uv venv
# Activate it
source .venv/bin/activate # macOS/Linux
# or
.venv\Scripts\activate # Windows
# Install PyPhi with all dev dependencies
uv pip install -e ".[dev,parallel,visualize,graphs,emd,caching]"| Task | Conda | uv |
|---|---|---|
| Create environment | conda create -n pyphi python=3.12 |
uv venv |
| Activate | conda activate pyphi |
source .venv/bin/activate |
| Install deps | conda env update -f environment.yml |
uv pip install -e ".[dev]" |
| Install package | conda install -c wmayner pyphi |
uv pip install pyphi |
| Run tests | pytest |
uv run pytest |
| Run Python | python script.py |
uv run python script.py |
| Add dependency | Edit environment.yml + conda env update |
Edit pyproject.toml + uv lock |
| List packages | conda list |
uv pip list |
| Update packages | conda update --all |
uv pip install --upgrade <package> |
Before (conda):
conda activate pyphi
pytest test/After (uv):
# Option 1: With activated venv
source .venv/bin/activate
pytest test/
# Option 2: Without activation
uv run pytest test/
# Option 3: Using Make
make testBefore (conda):
conda activate pyphi
conda install -c conda-forge jupyterlab jupyterlab-lsp python-lsp-server ipywidgetsAfter (uv):
uv pip install jupyterlab jupyterlab-lsp python-lsp-server ipywidgetsBefore (conda):
conda activate pyphi
cd docs
make htmlAfter (uv):
# Makefile now uses uv automatically
make docs
# Or manually:
uv run sphinx-build docs docs/_build/htmlBefore (conda):
conda activate pyphi
cd benchmarks
asv continuous developAfter (uv):
# Makefile now uses uv automatically
make benchmark- Conda: Environments stored centrally (e.g.,
~/miniconda3/envs/pyphi) - uv: Environment in project directory (
.venv/)
Benefit: Project-specific environments are easier to manage and don't clutter global namespace.
- Conda:
environment.ymlfile - uv:
pyproject.toml(already the source of truth for PyPhi)
Benefit: Single source of truth, no sync issues between conda and pip dependencies.
- Conda: No automatic lockfile (some tools add this)
- uv: Automatic
uv.lockwith exact versions of all dependencies
Benefit: Perfect reproducibility across machines and time.
- Conda: Can be slow, especially for large environments
- uv: 3-10x faster dependency resolution and installation
Benefit: Less waiting, faster iteration.
After installing uv, you may need to:
- Close and reopen your terminal
- Or run:
source ~/.bashrc(Linux) orsource ~/.zshrc(macOS)
uv uses PyPI by default. All PyPhi dependencies are available on PyPI with pre-built wheels.
If you had conda-specific packages, you'll need to find PyPI equivalents.
If you get import errors with Graphillion, rebuild it from source:
uv pip uninstall graphillion
uv pip install --no-binary graphillion graphillionThat's fine! The conda package is still available (though deprecated):
conda install -c wmayner pyphiNote that the conda package may not receive updates as frequently.
No! You can keep conda installed and use both. However, for PyPhi development, we recommend using uv.
The environment.yml file has been deprecated. All dependencies are now specified in pyproject.toml.
For JupyterLab setup, see the "Installing JupyterLab" section above.
Yes! uv pip is a drop-in replacement for pip, but you can also use regular pip if you prefer:
# These are equivalent
uv pip install pyphi
pip install pyphiHowever, uv pip is faster and integrates with uv.lock.
Edit pyproject.toml and run:
uv lock # Update lockfile
uv pip install -e . # Install updatesCI/CD workflows are being updated to use uv. See .github/workflows/ for examples.
- Documentation: https://github.com/astral-sh/uv
- Guide: https://docs.astral.sh/uv/
If you encounter issues during migration:
- Check this guide first
- Search GitHub Issues
- Ask in the pyphi-users group
- Open a new issue if needed
The migration from conda to uv is straightforward:
- ✅ Install uv
- ✅ Run
uv venvin project directory - ✅ Run
uv pip install -e ".[dev,parallel,visualize,graphs,emd,caching]" - ✅ Use
uv runprefix for commands or activate.venv