I'm trying to install python packages into QGIS via OSGeo4W. I've been following steps from YouTube on installing external Python libraries into QGIS from 'Amy Lou' and 'GEO 2004'. My operating system is Windows 11 version 22H2. Whenever I enter 'py3_env', I receive the message that it is not recognised. I have python 3 installed on my PC including the plugin in QGIS. I've also ensured that the environmental variables on my computer are correct.


1 Answer 1


QGIS on Windows can generally be installed in one of two ways: through the network installer, or through a stand-alone installer. Both are provided by OSGeo4W and both works fine and have their pros and cons.

With the network installer, what is actually installed is an application called OSGeo4W Setup. This application is installed with the executable found at: https://download.osgeo.org/osgeo4w/v2/

OSGeo4W Setup is a distributor of pre-built packages for Windows. It is very practical to update versions of programs installed through it (such as QGIS or GRASS) but also to install additional libraries.
For example, the python3-remotior-sensus package is already in the repository, which is necessary for version 8 of the SemiAutomatic Classification Plugin. There is also python3-geopandas, python3-jupyter, and many others.
Among its advantages is that the dependencies of any library are also found in the repository, in the required version.

If you installed the OSGeo4W Setup application, you probably don't even need to open the OSGeo4W Shell to install Python packages.

Stand-alone installers, on the other hand, install a specific version of QGIS. They change location regularly, currently the installers for versions between 3.28 and 3.34 are found in: https://download.qgis.org/downloads/

Its advantage is that you can have as many versions of QGIS as you want, installed on the same machine.
But to install additional libraries, you need to open the OSGeo4W Shell console and install manually.

Some time ago, both installers came with a py3_env.bat file, which set up a Python environment to work within. Currently, the Python environment is configured at the same time that the OSGeo4W Shell console is opened, so it is not necessary to run that command.

The installation of additional libraries is carried out with commands of the type:
python -m pip install remotior-sensus
python -m pip install geopandas

In these installations it is important to read the results of the command, since dependencies between different libraries can be easily broken.
Under no circumstances modify the version of a library that was already installed, since other libraries could depend on that version. When in doubt, better use the network installer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.