[QGIS-Developer] Python regression in the latest patch release 3.34.3

Lauri Kajan lauri.kajan at gmail.com
Tue Jan 30 23:57:40 PST 2024


Hi all,

This might be more of an OSGeo4W issue, but I wanted to bring it to your
attention.

Unfortunately, something has changed in the latest patch release 3.34.3 on
Windows regarding Python.
The logic of how Python finds its DLLs has changed somehow. I know that
Python has upgraded to 3.9.18 to get necessary security updates.

We have relied on the process where we create a virtual environment for
plugin development. We have previously created it with command
`C:\Program Files\QGIS 3.34.3\apps\Python39\python.exe -m venv
--system-site-packages .venv`
We have then set the needed module lookup path with a `pth`-file and dll
paths with the `sitecustomize.py` in the virtual environment.

This has worked great previously but now fails.
The first error I got is that `zlib.dll` was not found. This can be “fixed”
by copying it to `C:\Program Files\QGIS 3.34.3\apps\Python39` (which I
would prefer not to do since our training clients don’t necessarily have
permissions for that on their computers).
The second problem comes when `pip` is tried to be installed to the venv by
`ensurepip`. This step fails because python.exe won’t find its
`python39.dll`.
The venv can be created with `--without-pip` flag but after activating the
vevn and calling python.exe, it also fails to start and gives an error
`python39.dll` is not found. How come python.exe can't find the DLL file
from `apps\Python39` which is correctly set as `home` in the `pyvenv.cfg`?
If the `C:\Program Files\QGIS 3.34.3\apps\Python39` folder is added to
`PATH`, then python39.dll can be found. This is also a step I would prefer
not to be necessary.


Is this something that was expected in the Python upgrade?
Has this changed in Python itself or has something changed in OSGeo4W
packaging?
Is it expected that the previous mode of operation will be restored?

Does anyone have any ideas on how to overcome this?


Regards,

Lauri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240131/0265a03b/attachment.htm>


More information about the QGIS-Developer mailing list