To use scanpy from another project, install it using your favourite environment manager:
::::{tabs}
:::{group-tab} Hatch (recommended)
Adding scanpy[leiden] to your dependencies is enough.
See below for how to use Scanpy’s {ref}dev-install-instructions.
:::
:::{group-tab} Pip/PyPI If you prefer to exclusively use PyPI run:
$ pip install 'scanpy[leiden]':::
:::{group-tab} Conda After installing installing e.g. Miniconda, run:
$ conda install -c conda-forge scanpy python-igraph leidenalgPull Scanpy from PyPI:
$ pip install scanpy:::
::::
If you use Hatch or pip, the extra [leiden] installs two packages that are needed for popular
parts of scanpy but aren't requirements: igraph {cite:p}Csardi2006 and leiden {cite:p}Traag2019.
If you use conda, you should to add these dependencies to your environment individually.
(dev-install-instructions)=
To work with the latest version on GitHub: clone the repository and cd into its root directory.
$ gh repo clone scverse/scanpy
$ cd scanpy::::{tabs}
:::{group-tab} Hatch (recommended)
To use one of the predefined Hatch environments in {file}hatch.toml,
run either hatch test [args] or hatch run [env:]command [...args], e.g.:
$ hatch test -p # run tests in parallel
$ hatch run docs:build # build docs
$ hatch run towncrier:create # create changelog entry:::
:::{group-tab} Pip/PyPI
If you are using pip>=21.3, an editable install can be made:
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -e '.[dev,test]':::
:::{group-tab} Conda
If you want to let conda handle the installations of dependencies, do:
$ pipx install beni
$ beni pyproject.toml > environment.yml
$ conda env create -f environment.yml
$ conda activate scanpy
$ pip install -e '.[dev,doc,test]'For instructions on how to work with the code, see the {ref}contribution guide <contribution-guide>.
:::
::::
If you're using Docker, you can use e.g. the image gcfntnu/scanpy from Docker Hub.
If you get a Permission denied error, never use sudo pip. Instead, use virtual environments or:
$ pip install --user scanpy