Advanced Installation Instructions

This document provides details on how to install and manage your own scientific Python + sunpy installation. If you have never installed/used a scientific Python environment, we recommend that you follow the Miniconda 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.

Warning

Users of the Miniconda python distribution should follow the instructions for Installing Scientific Python and sunpy. Mixing packages from conda and pip is not recommended.

Prerequisites

You will need a C compiler (e.g., gcc or clang) to be installed as we have a C library within sunpy that is built at install time. We do provide compiled binaries for sunpy for Linux and Mac OS X (we do not compile our C extension on Windows), so you might not need a C compiler. If you use Miniconda, you can get these compilers from there. 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.

Using pip

Note

We strongly recommend using a Python virtual environment so any Python packages you install will be kept separate from your Operating System Python. You can use Conda as a virtual environment manager instead of one of the more common Python virtual environment managers.

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 encompassed by a [dev] option, so you can do:

pip install sunpy[dev]

to install all the packages needed to run and develop sunpy. However if you want to develop sunpy we would strongly recommend reading Newcomers’ Guide.

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.

Do not install sunpy or other third-party packages using sudo.

Testing sunpy

Warning

The tests will fail if you do not install all the optional dependencies. If you have installed sunpy with conda-forge, you will be missing the pytest-mock package which will cause the test suite to fail.

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

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:

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

sunpy also depends on other packages for optional features. However, note that these only need to be installed if those you have requested them when you pip install them. They are installed by default if you use the conda-forge sunpy package.

The following optional packages are:

To run the tests: