Hi Lauri,

have you considered using the python-qgis.bat/python-qgis-ltr.bat instead? That should set all PATHs etc correctly.

Cheers, Hannes

On 31.01.24 08:57, Lauri Kajan via QGIS-Developer wrote:
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

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

--
Johannes Kröger / GIS-Entwickler/-Berater

---------------------------------------------
Aufwind durch Wissen!
Web-Seminare und Online-Schulungen
bei der www.foss-academy.com
---------------------------------------------

WhereGroup GmbH
c/o KK03 GmbH
Lange Reihe 29
20099 Hamburg
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

johannes.kroe...@wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to