Installation#
To use scanpy
from another project, install it using your favourite environment manager:
Adding scanpy[leiden]
to your dependencies is enough.
See below for how to use Scanpy’s Development Version.
If you prefer to exclusively use PyPI run:
$ pip install 'scanpy[leiden]'
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 [Csárdi and Nepusz, 2006] and leiden [Traag et al., 2019].
If you use conda, you should to add these dependencies to your environment individually.
Development Version#
To work with the latest version on GitHub: clone the repository and cd
into its root directory.
$ gh repo clone scverse/scanpy
$ cd scanpy
To use one of the predefined Hatch environments in 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
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]'
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 contribution guide.
Docker#
If you’re using Docker, you can use e.g. the image gcfntnu/scanpy from Docker Hub.
Troubleshooting#
If you get a Permission denied
error, never use sudo pip
. Instead, use virtual environments or:
$ pip install --user scanpy