SPy requires Python and depends on several other freely available Python modules. Prior to installing SPy, you should make sure its dependencies are met. While you can use SPy to process hyperspectral data with just Python and NumPy, there are several other modules you will need if you want to use any of SPy’s graphical capabilities.
|Python 2.6+ or 3.3+||(1)|
|Pillow or Python Imaging Library (PIL)||Required if displaying or saving images|
|matplotlib||Required if rendering raster displays or spectral plots|
|IPython||Required for interactive, non-blocking GUI windows|
As of SPy version 0.10, IPython is used to provide interactive GUI windows. To use SPy with IPython, you will need to start IPython in “pylab” mode (see Starting IPython).
SPy is distributed as a Python source distribution, which can be downloaded from the Python Package Index (PyPI) or from the SPy Project Page on GitHub. The source distribution will unpack to a directory with a name like spectral-x.y, where x.y is the SPy version number. To install SPy, open a console in the unpacked directory and type the following:
python setup.py install
Note that if you are on a unix-based system, you will either need to be logged in as root or preface the above command with “sudo” (unless you use the -d option to install it to a local directory).
or using pip, type
pip install spectral
Note that your pip binary may be named differently (e.g., “pip-python”). And again, you may need to be logged in as root or use “sudo” if you are on a unix-based system.
The latest version of the SPy source code resides in the GitHub source code repository. While the latest source code may be less stable than the most recent release, it often has newer features and bug fixes. To download the latest version of SPy from the Git repository, cd to the directory where you would like to check out the source code and type the following:
git clone https://github.com/spectralpython/spectral.git
Because hyperspectral data files can be quite large, you might store all your HSI data in one or several specific directories. To avoid having to type absolute path names whenever you attempt to open an HSI file in SPy, you can define a SPECTRAL_DATA environment variable, which SPy will use to find image files (if they are not found in the current directory). SPECTRAL_DATA should be a colon-delimited list of directory paths.