Fix error

Fix QGIS Python errors on Windows — GDAL & module not found fixes

Fix Python errors in QGIS on Windows: No module named qgis, GDAL not found, DLL load failed. Install Python packages correctly using the OSGeo4W Shell.

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.

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 package
ImportError: DLL load failed importing _gdal
Missing Visual C++ Redistributable or GDAL version mismatch
Install vc_redist.x64.exe from microsoft.com
ModuleNotFoundError: No module named numpy
Python package missing from OSGeo4W environment
Install from OSGeo4W Shell: pip3 install numpy
Python error: No module named PyQt5
PyQt5 not installed in OSGeo4W Python
Re-run osgeo4w-setup.exe and add python3-pyqt5 package

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.
OSGeo4W Shell (from Start menu)
# 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

Debug Python errors in QGIS Python Console

QGIS Python Console (Plugins > 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

Repair the QGIS Python environment

  • 1

    Re-run osgeo4w-setup.exe

    Open OSGeo4W setup → Advanced Install → find python3 and qgis-ltr packages → set both to Reinstall.

  • 2

    Clear pip cache

    OSGeo4W Shell
    C:\OSGeo4W> pip3 cache purge
  • 3

    Test the environment

    OSGeo4W Shell
    C:\OSGeo4W> python3 -c "import qgis; from osgeo import gdal; print('OK')"
    OK

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.

QGIS not opening at all?

Startup crash fix guide.

Not opening fix