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.
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.
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
Then enter the virtualenv
Activate it in order to install the libraries inside it.
We will now install the rest of the libraries using pip inside our virtual environment.
pip3 install pyproj
pip3 install pyshp
pip3 install pyshp
pip3 install pandas
pip3 install numpy
pip3 install scipy
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
pip3 install django
pip3 install shapely
pip3 install pysal
pip3 install descartes
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.