Installation¶
Python¶
Note
download and install anaconda3 from https://www.anaconda.com/download/
Python is an application to run python scripts. It includes a Python Standard Library with many modules (mathematical tools, file and directory access, etc.). The Python Standard Library can be extended by a wide range of free available packages offered by third parts. A package bundles all files used in a module, including, apart of python files and where applicable, example data, libraries (.dll, .so), etc. Modules are python files and packages. Python distributions add selected free available packages to Python (including its standard library).
We recommend to install anaconda, a distribution including python and over 1000 packages. Check whether your computer has a 32 or 64-bit processor. Donwload anaconda’s latest Python 3 version from https://www.anaconda.com/download/ and install it. Use the default installation options. After finishing the installation, you should find a folder anaconda3 in your home directory (typically /home/MYNAME/anaconda3 in linux or C:/users/MYNAME/Anaconda3 in windows).
Third part packages not included in Anaconda can be additionally installed using the commands pip or conda. Both are package management systems used to install and manage software packages.
pip¶
PIP is a package manager to install, update, and uninstall packages. Your computer may have different python installations: anaconda3, anaconda2, native python (linux, mac), python inside some software (ArcGIS, QGIS, etc.), etc. Each of them has probably its own pip. Be sure you are installing girs on anaconda3 by using the right pip, in our case ~/anaconda3/bin/pip. You can check in a terminal:
> pip -version
Installing gdal¶
Note
girs uses, among others, the gdal library. Depending on the operating system (windows, linux, mac) and on the python distribution, GDAL’S installation can be tricky. Therefore, I recommend installing and testing gdal before installing girs.
Windows:
- start the conda prompt
- install gdal
Linux & Mac OS:
- start a terminal
- install gdal
> conda install gdal
conda will inform which packages will be new installed, updated or downgraded.
gdal for windows and python 2.7¶
Eventually you will face problems installing gdal for windows unter python 2.7. Even if gdal was succesfully installed with conda, it may fail the test from osgeo import gdal, ogr, osr as described in Chapter Testing gdal. In this case, first uninstall gdal:
> conda uninstall gdal
Then download and install the last gdal version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal. Currently they are:
- GDAL‑2.2.4‑cp27‑cp27m‑win32.whl: for 32-bits CPU
- GDAL‑2.2.4‑cp27‑cp27m‑win_amd64.whl: for 64-bits CPU
Check your pip (see below)
> pip --version
Install the wheel, for example for a 64-bit computer:
> pip install ~/Downloads/GDAL‑2.2.4‑cp27‑cp27m‑win_amd64.whl
Test gdal with python using from osgeo import gdal, ogr, osr as described above.
Testing gdal¶
Start python in the same terminal and insert:
> python
>>> from osgeo import gdal, ogr, osr
If there is no error, gdal was succesfully installed.
Installing girs¶
Note
pip install girs
girs is currently only available using pip.
Using pip:
> pip install girs
pip in a virtual environment¶
If you face problems to install gdal in the virtual environment in linux:
> sudo apt-get install libgdal-dev
> sudo apt-get install gdal-bin
> pip install GDAL==$(gdal-config --version) --global-option=build_ext --global-option="-I/usr/include/gdal"
For windows you can install a wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal as described above.
Installing dependencies¶
All dependencies should be automatically installed. Known issues are known for gdal, as described above. The dependencies are:
- future
- gdal
- numpy
- scipy
- pandas
- matplotlib
Testing the installation¶
To check whether dependencies are correctly installed:
import girs
girs.check_packages()