SETTING UP YOUR GEOSPATIAL PYTHON ENVIRONMENT: PART 2

In this post, we begin where Part 1 left off on how to set up your geospatial python environment. We will install some of the libraries together with the dependencies on Ubuntu 16.04 LTS. All the commands are input in the terminal which can be accessed by Ctrl +Alt+T.

First, we will install build-essentials which is acts as a reference for compiling debian packages and install pip3 which will install all the libraries mentioned in the previous article. Pip3 will be used to install setuptools which will allow us to download and install Python packages automatically.

Installing prerequisites

Use the commands sudo apt-get install build-essential to install build essentials and sudo apt-get install python3-pip to install pip. Now, use pip3 to install python set up tools through this command pip3 install -U pip3 setuptools. Once the installations are over, you are ready to move in to the next stage.

Installing Virtualenv

Use the following command that utilizes pip3 to install virtual environment in your pc.
sudo pip3 install virtualenv
Now create your own virtual environment called VENV using the following command
virtualenv VENV
Then enter the virtualenv
cd VENV
Activate it in order to install the libraries inside it.
. bin/activate
We will now install the rest of the libraries using pip inside our virtual environment.

Pyproj
pip3 install pyproj
Pyshp
pip3 install pyshp
Geojson
pip3 install pyshp
Pandas
pip3 install pandas
Numpy
pip3 install numpy
Scipy
pip3 install scipy
Matplotlib

For matplotlib, install the following requirements in the main Operating System using this command:
sudo apt-get install freetype* libpng-dev libjpeg8-dev
After that, install matplotlib in your virtual environment using pip
pip3 install matplotlib
Django
pip3 install django
Shapely
pip3 install shapely
PySAL
pip3 install pysal
Descartes
pip3 install descartes
Folium
pip3 install folium
With most of the Python geospatial libraries installed, you can exit the virtual environment using the deactivate command. In part 3, we will install mapnik, GDAL (in the easiest way possible), PostgreSQL and finally PostGIS.

RELATED:  Create web map applications using Mango

 

Bonface Thaa
About thaabonface 7 Articles
Bonface Thaa is Python developer and a GIS software consultant who graduated from Dedan Kimathi University of Technology with a Bachelor of Science degree in Geomatic Engineering. He is passionate about GIS technologies and has expertise in designing and developing custom GIS solutions using Python as well as popular mapping JavaScript Libraries. Bonface likes to read and write articles from time to time. He is also passionate about attending and participating in seminars, GIS hackathons and conferences.