While the most common and widely-used Python packages are shipped with QGIS, and they can be used by plugins without any additional actions, some QGIS plugins need third-party Python packages, which are not available with the default QGIS installation.
This recipe shows you how to add missing Python packages to the QGIS installation.
To follow this recipe, you may need administrator rights if you are a Windows user, and QGIS is installed in the system drive.
This steps will install pip — a Python package management tool:
get-pip.py file from https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py and save it somewhere on your hard drive, for example in D:\Downloads.python D:\Downloads\get-pip.py. Don't forget to replace D:\Downloads with the correct path to the get-pip.py file. Wait while the command execution completes.Now, when pip is ready, you can easily download and install third-party Python packages. To do this, perform the following steps:
pip install package_name. Don't forget to replace package_name with the name of the package that you want to install. For example, if you want to install the PySAL package, use this command: pip install pysal.If you are a Linux user, use your package manager to install pip. For example, under Debian and Ubuntu, use the sudo apt-get install python-pip command to install pip. After doing this, you can use pip to download and install packages as described in the preceding paragraph.
Mac OS users can install pip via Homebrew using the brew install pip command.
Using pip, you also can view installed packages, update, and remove them. For more information please look at the pip documentation available at https://pip.pypa.io/en/stable/.
pip downloads the requested package with all necessary dependencies from the Python Package Index (https://pypi.python.org/) and installs them into Python bundled with QGIS.
You can also register Python bundled with QGIS in the Windows registry as the system default Python version. After this, you can use usual Windows installers to install the required packages. More information on this topic can be found at https://trac.osgeo.org/osgeo4w/ticket/114.