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.
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.
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
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:
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.
You will need a C compiler (e.g.,
clang) to be installed.
If you use anaconda, you can get these packages from there instead.
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.
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
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 has the following strict requirements:
Python 3.6.x or later.
NumPy 1.15.0 or later.
SciPy 1.0.0 or later.
Astropy 3.2.0 or later.
pandas 0.23.0 or later.
parfive 1.0 or later.
matplotlib 2.2.2 or later.
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
spectra. These are the strict requirements and the following optional