Below are instructions for installing SunPy and its prerequisites on different platforms.
SunPy consists of many submodules that each have their own requirements. You do not need to fufill all the requirements if you only intend on using parts of SunPy. It is of course reccomended that you install the requirements for all of SunPy.
The Full set of requirements is: numpy >= 1.6.0 scipy >= 0.10.0 matplotlib >= 1.1 pandas >= 0.10.0 astropy >= 0.2.0 suds beautifulsoup4
To import SunPy core (including sun, time, util) you need the following dependacies: numpy scipy
Any submodules with extra requirements are listed below: instr: astropy.io.fits matplotlib
io: Optionally either of: astropy.io.fits openjpeg
lightcurve: pandas astropy.io.fits matplotlib
map: astropy.io.fits matplotlib
net: suds beautifulsoup4
For instructions on setting up the scientific Python environment which is required by SunPy, choose your OS from the list below. When you are done come back here and follow the instructions below to install SunPy and its requirements.
Alternatively, available for all platforms is Anaconda, a scientific Python distribution that is available free of charge from https://store.continuum.io/cshop/anaconda/. It comes with a complete build environment so you will not need to worry about installing a compiler or likewise.
Head to the download page, install it and you are set. It can also be installed into your user directory without administrator permissions; be sure to use the Anaconda versions of the commands in the following listings if you have multiple Python environments installed.
Making sure to have followed one of the guides previously. You will have installed on your system: Python, Numpy, Scipy, Matplotlib, git, pip and Qt. There are few more remaining dependencies which must be installed using pip. Depending on which system you are using some of these may already be installed but it does not hurt to upgrade:
pip install --upgrade distribute pip install --upgrade pyfits pip install --upgrade suds pip install --upgrade pandas pip install --upgrade beautifulsoup4
We also recommend you use ipython (a great python enviromnent). This can also be installed using pip:
pip install --upgrade ipython
All done with the SunPy Python prerequisites. You are now ready to install SunPy itself.
There are two different versions of SunPy. Currently, we recommend that users install the latest stable release. However, the bleeding edge version on our GitHub page is quite easy to install and you do get the latest and greatest but it may have bugs. Depending on your setup, you may need to preface each of the pip ... commands with sudo pip ....
It is as simple as this:
pip install sunpy
If you are upgrading the package:
pip install --upgrade sunpy
For those who like to download the source. You have a range of download locations.
Github (tar.gz): Download
Github (zip): Download
Then you can use:
pip install ./<path to download>/SunPyDownload.file_extension
In some cases you may need the --no-deps flag if pip is trying to upgrade dependencies such as SciPy and Matplotlib that are difficult to build from source and the likely errors will abort the upgrade. That’s it folks!
If you do fancy the latest version of SunPy. Then you will want to cd into directory you want to have SunPy located and now:
git clone firstname.lastname@example.org:sunpy/sunpy.git
or using HTTP:
git clone http://github.com/sunpy/sunpy.git
This will download the SunPy repository and create a sunpy folder at the current location. With time, updates will happen and you can update your local copy by:
git pull upstream master
Finally, to install or upgrade the local version of SunPy you can run:
python setup.py install --upgrade
Now you can test your installation. Open a new Python shell and type these commands:
>>> import sunpy >>> sunpy.Map(sunpy.AIA_171_IMAGE).peek()
If all goes well you should see an AIA 171 image on your screen.