How to install napari#

This guide will teach you how to do a clean install of napari and launch the viewer.

If you’re already familiar with Python, napari can be installed from PyPI or conda-forge using your favorite virtual environment and package manager. Otherwise, keep reading for instructions on how to install napari as a Python package.

Tip

If you just want to get started quickly with napari as an app, check out our napari app installation instructions.

Checking it worked#

After installation you should be able to launch napari from the command line by simply running

napari

An empty napari viewer should appear as follows:

Screenshot of an empty napari viewer, right after launching.

Note

On some platforms, particularly macOS and Windows, there may be a ~30 second delay before the viewer appears on first launch. This is expected and subsequent launches should be quick. However, anti-malware and other security software measures may further delay launches—even after the first launch.

You can check the napari version, to ensure it’s what you expect, for example the current release 0.6.5, using the command: napari --version .

Advanced installation options#

Choosing a different Qt backend#

napari needs a library called Qt to run its user interface (UI). In Python, there are two alternative libraries to run this, called PyQt5 and PySide2. By default, we don’t choose for you, and simply running python -m pip install napari will not install either. You might already have one of them installed in your environment, thanks to other scientific packages such as Spyder or matplotlib. If neither is available, running napari will result in an error message asking you to install one of them.

Running python -m pip install "napari[all]" will install the default framework, which is currently PyQt5–but this could change in the future.

To install napari with a specific framework, you can use:

python -m pip install "napari[pyqt6, optional]"    # for PyQt6

# OR
python -m pip install "napari[pyside2, optional]"  # for PySide2

By including optional you will install everything that napari[all] includes, but with the Qt backend of your choice.

Please note that, if you have a Mac with the newer arm64 architecture (Apple Silicon), then installing the PySide2 backend using pip is not supported because pre-compiled PySide2 packages (wheels) are not available on PyPI, the repository used by pip. However, you can install pyside2 separately, for example from conda-forge, and then use pip install napari.

Note

If you switch backends, it’s a good idea to pip uninstall the one you’re not using.

Using constraints files#

Since napari 0.4.18, we store constraints files with information about each exact dependency version against which napari was tested. This could be useful if you need to install napari as a package from PyPI, and prevents creating environments where napari does not start or work properly.

The constraints files are stored in the napari repository under resources/constraints/constraints_py3.10.txt. To find constraints for specific releases, go under the link https://github.com/napari/napari/tree/{tag}/resources/constraints replacing {tag} with the desired napari version.

pip install napari[backend_selection] -c path/to/constraints/file

For example, if you would like to install napari with PyQt6 on python 3.10:

pip install napari[pyqt6, optional] -c constraints_py3.10.txt

Next steps#

  • to start learning how to use napari, checkout our getting started tutorial

  • if you are interested in contributing to napari please check our contributing guidelines

  • if you are running into issues or bugs, please open a new issue on our issue tracker

  • if you want help using napari, we are a community partner on the imagesc forum and all usage support requests should be posted on the forum with the tag napari. We look forward to interacting with you there!