Skip to content

Setup

Prerequisites

  • QGIS >= 3.34 along with it's python bindings

Virtual environment creation

An environment with qgis bindings is needed. To create it easily i recommend using the QGIS Venv Creator project by GipsoCoding.

qgis-venv-creator installation

pipx install qgis-venv-creator
Or in an existing environment
pip install qgis-venv-creator

Create your pyQgis environment
create-qgis-venv --venv-name "qgis_bindings.venv"

If multiple QGIS installation are detected the prompt will ask you to choose one.

Activate your venv
qgis_bindings.venv/Scripts/activate

You should be able to use qgis python bindings. And if you activate this environment in your IDE you should have autocompletion available.

Install PyQgis Wrapper

Install from git
pip install git+https://forge.inrae.fr/dynafor/librarys/pyqgis-wrapper.git
Development mode
git clone https://forge.inrae.fr/dynafor/librarys/pyqgis-wrapper.git
cd pyqgis_wrapper
pip install -e .
source branch

The source branch exposes only the src folder. Use this branch if you want to include the library directly in your plugin or project.