Since I started developing AequilibraE, one of the greatest constraints I was subject to (if not the single greatest) was the limited number of installed python libraries distributed with QGIS for Windows, which really limited the features I could add to the package and how I had to write certain features, resulting in (often) convoluted code or just plain silly implementations of basic operations used in transportation modelling data processing

QGIS’s development team, however, has improved things dramatically for QGIS 3, and we can now install packages (pure-python or pre-compiled ones) straight from the OSGeo4W shell, as described in this excellent thread from the GIS StackExchange.

Let’s suppose, for example, that one wants to install the basic tools to manipulate transportation matrices and data within a QGIS Plugin, and for such they want to install Pandas and OpenMatrix. To do so, one only needs to run the OSGeo4W shell as an administrator (gets installed when you install QGIS) and type the following commands.

python3 -m pip install pandas
python3 -m pip install openmatrix

This process might fail if the package requires compilation or has some complex dependencies, but I have run only limited testing, with only Fiona failing to install of those I tested.

For those that want something slightly easier to follow, I made a little video tutorial.

import subprocess as sb
sb.Popen("python3 -m pip install pandas")
sb.Popen("python3 -m pip install openmatrix")

This last bit is not on the video tutorial, as I have found about it after I have PS – I vaguely remember the brilliant Anita Graser touching on this topic a while ago, but I could not find the post she wrote about it, so I could not reference it here originally published this post.