Advanced Installation Instructions

This document provides details on things you need to know to install and manage your own scientific Python + SunPy installation. If you have never installed or used scientific Python we recommend that you follow the Anaconda installation instructions.

Installing SunPy on top of an existing Scientific Python Environment

These instructions assume you have a scientific Python distribution with access to the pip command installed.

Prerequisites

You will need a compiler suite and the development headers for Python and numpy in order to build SunPy. On Linux, using the package manager for your distribution will usually be the easiest route, while on MacOS X you will need the XCode command line tools.

The instructions for building Numpy from source are also a good resource for setting up your environment to build Python packages.

Using pip

Warning

Users of the Anaconda python distribution should follow the instructions for Using Conda.

SunPy consists of many submodules that each have their own requirements. You do not need to fulfil all the requirements if you only intend on using parts of SunPy. It is however strongly recommended to have all the dependencies installed (with the potential exception of glymur).

There are multiple options depending on how many optional dependencies you want to install:

To install SunPy with pip including optional dependencies (recommended), simply run:

pip install sunpy[all]

To install SunPy with no optional dependencies:

pip install sunpy

To install SunPy with net-based dependencies:

pip install sunpy[net]

To install SunPy with database dependencies:

pip install sunpy[database]

Other available options are: [image], [jpeg2000], [asdf], [tests] and [docs].

The entire list of options are compassed by a [dev] option, so you can do:

pip install sunpy[dev]

to install all the packages needed to run and develop SunPy.

Note

You will need a C compiler (e.g., gcc or clang) to be installed. If you use anaconda, you can get these packages from there instead.

Note

If you get a PermissionError this means that you do not have the required administrative access to install new packages to your Python installation. In this case you may consider using the --user option to install the package into your home directory. You can read more about how to do this in the pip documentation.

Alternatively, if you intend to do development on other software that uses SunPy, such as an affiliated package, consider installing SunPy into a virtualenv.

Do not install SunPy or other third-party packages using sudo unless you are fully aware of the risks.

Testing SunPy

Warning

The tests will fail if you do not install all the optional dependencies.

The easiest way to test your installed version of SunPy is running correctly is to use the sunpy.self_test() function:

import sunpy
sunpy.self_test()

which will run many of the SunPy tests.

The tests should run and print out any failures, which you can report at the SunPy issue tracker.

SunPy’s Requirements

SunPy has the following strict requirements:

SunPy also depends on other packages for optional features. However, note that these only need to be installed if those particular features are needed. SunPy will import even if these dependencies are not installed.

To run the tests:

The packages that will be installed as dependencies by default and are the ones required to import the core datatypes map, timeseries and spectra. These are the strict requirements and the following optional packages: