[gdal-dev] setting PYTHONSO correctly on Windows for VRT pixel functions

Gregory, Matthew matt.gregory at oregonstate.edu
Fri May 2 09:57:27 PDT 2025


Hi all,

I'm following the instructions for using Python pixel functions to create derived VRT bands here (https://gdal.org/en/stable/drivers/raster/vrt.html#using-derived-bands-with-pixel-functions-in-python).  

Based on the section for "Linking mechanism to a Python interpreter", I've tried the following:

  set PYTHONSO=python312.dll

and 

  set PYTHONSO=C:\Users\xxx\AppData\Local\Programs\Python\Python312\python312.dll

(Note that C:\Users\xxx\AppData\Local\Programs\Python\Python312 in in my PATH, so I thought the first would work).

Neither of these worked and I'm getting this message when running "gdalinfo -stats test.vrt"

ERROR 1: Cannot load C:\Users\gregorma\AppData\Local\Programs\Python\Python312\python312.dll

If I run this without PYTHONSO being set, I get:

ERROR 1: Cannot find python/libpython. You can set the PYTHONSO configuration option to point to the a python .so/.dll/.dylib

One possible complication is that I'm running this in a virtual environment, but as far as I'm aware the virtual environment has no separate DLL associated with it and relies on the base Python's DLL.  

Thanks for any advice on getting this set up correctly.

matt


More information about the gdal-dev mailing list