QGIS uses its own bundled Python from OSGeo4W — not the system Python. Never install QGIS Python packages with the system pip. Always use the OSGeo4W Shell.
Common errors
Python and GDAL errors in QGIS on Windows
No module named qgis on startup
System Python being used instead of OSGeo4W Python
Reinstall QGIS via OSGeo4W. Never run QGIS with system Python.RuntimeError: GDAL library not found
GDAL DLLs not on PATH or corrupted install
Re-run osgeo4w-setup.exe and reinstall qgis-ltr packageImportError: DLL load failed importing _gdal
Missing Visual C++ Redistributable or GDAL version mismatch
Install vc_redist.x64.exe from microsoft.comModuleNotFoundError: No module named numpy
Python package missing from OSGeo4W environment
Install from OSGeo4W Shell: pip3 install numpyPython error: No module named PyQt5
PyQt5 not installed in OSGeo4W Python
Re-run osgeo4w-setup.exe and add python3-pyqt5 packageInstall Python packages
Install Python packages for QGIS on Windows
Always install Python packages for QGIS using the OSGeo4W Shell, not the Windows Command Prompt or your system Python pip.
# Install a package into the QGIS Python environment:
C:\OSGeo4W> pip3 install geopandas
# Install multiple packages:
C:\OSGeo4W> pip3 install pandas matplotlib requests
# Check what is installed:
C:\OSGeo4W> pip3 list | findstr -i geo
# Check Python version:
C:\OSGeo4W> python3 --version
Python 3.12.4
QGIS Python console
Debug Python errors in QGIS Python Console
# Check Python version inside QGIS:
>>> import sys; print(sys.version)
3.12.4 (main, ...) [MSC v.1940 64 bit (AMD64)]
# Check sys.path to see where Python looks for modules:
>>> import sys; print(sys.path)
# Check GDAL:
>>> from osgeo import gdal; print(gdal.__version__)
3.9.2
Fix corrupted environment
Repair the QGIS Python environment
- 1
Re-run osgeo4w-setup.exe
Open OSGeo4W setup → Advanced Install → find
python3andqgis-ltrpackages → set both to Reinstall. - 2
Clear pip cache
C:\OSGeo4W> pip3 cache purge - 3
Test the environment
C:\OSGeo4W> python3 -c "import qgis; from osgeo import gdal; print('OK')"OK
FAQ
Python error questions
Can I use geopandas in QGIS on Windows?
Yes. Install it from the OSGeo4W Shell:
pip3 install geopandas. Since OSGeo4W already has GDAL and Shapely, geopandas installs quickly without dependency conflicts. Then import it in the QGIS Python Console: import geopandas as gpd.Plugin causes Python error on every QGIS start
Disable the plugin: hold Shift while starting QGIS to skip plugins, then go to Plugins → Manage and Install Plugins → find the problematic plugin → uncheck it. Update the plugin or reinstall it if needed.