This is a step-by-step guide intended for those unfamiliar with Python or the command-line (a.k.a. the "shell").
A shell can be opened by opening a new tab in the Terminal app (located in
Utilities). Text that is formatted like code is meant to be copied and
pasted into the terminal (hit the Enter key to run the command).
The first step is to install uv, a fast Python package manager that will handle Python installation and package management for us.
Install uv by running this command in your terminal:
curl -LsSf https://astral.sh/uv/install.sh | shAfter installation completes, close and re-open your Terminal window for the changes to take effect.
Now we can use uv to create a Python environment and install PyPhi. Navigate to the directory where you want to work on your project:
cd ~/your/project/directoryCreate a new Python environment for your project:
uv venvThis creates a virtual environment in a .venv directory. Virtual
environments allow different projects to isolate their dependencies from one
another, so that they don't interact in unexpected ways.
Activate the environment:
source .venv/bin/activateImportant
Remember to activate your project's environment every time you begin
working on your project. When the environment is active, your
command-line prompt should show (.venv) at the beginning.
Now install PyPhi:
uv pip install pyphiCongratulations, we've just installed PyPhi!
To play around with the software, let's install IPython. IPython provides an enhanced Python REPL that has tab-completion, syntax highlighting, and many other nice features.
uv pip install ipythonNow we can run ipython (or uv run ipython) to start an IPython session.
In the Python command-line that appears (it's preceded by the >>> prompt),
run:
import pyphiNow you've imported PyPhi and can start using it!
Next, please see the documentation for some examples of what PyPhi can do and information on how to configure it.
Note
The conda-based installation method is deprecated. We recommend using uv as described above for a faster and more reliable experience.
If you prefer to use conda, you can follow the old installation method:
Install Miniconda by downloading and running the installer script:
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o Miniconda3-latest-MacOSX-x86_64.sh
sh Miniconda3-latest-MacOSX-x86_64.shCreate and activate a conda environment:
conda create --name <name_of_your_project> python=3.12
conda activate <name_of_your_project>Install PyPhi:
pip install pyphi