[osgeo4w-dev] [osgeo4w] #814: stdlib venv's broken on new Python 3.9.18

OSGeo4W trac_osgeo4w at osgeo.org
Thu Feb 1 01:39:43 PST 2024


#814: stdlib venv's broken on new Python 3.9.18
--------------------------------------+----------------------------
Reporter:  akominlsfi                 |       Owner:  osgeo4w-dev@…
    Type:  defect                     |      Status:  new
Priority:  critical                   |   Component:  Package
 Version:                             |  Resolution:
Keywords:  python, stdlib, venv, dll  |
--------------------------------------+----------------------------
Comment (by akominlsfi):

 For context our current plugin development install workflow on Windows
 looks this this (related to [https://trac.osgeo.org/osgeo4w/ticket/692
 previous issue] about stdlib dll patching):

 - Install QGIS via network installer (each version or ltr/non-ltr branch
 to separate root directory)
 - Patch the installation stdlib & site-packages
   - For apps/python39/python.exe to run without adding /bin to PATH:
      - Copy zlib.dll from /bin to /apps/python39
   - For venvs without --system-site-packages
     - Allow stdlib to work by copying sqlite/libcrypto/libssl dlls from
 /bin to /apps/python39/dlls, since .pths in system paths are not sourced
   - For venvs with --system-site-packages
     - Allow site-packages modules to access dlls in /bin by adding
 /apps/python39/bin-dlls.pth file with os.add_dll_directory('path-to-/bin')
     - Allow site-packages PyQt5 to access its dlls in /apps/Qt5/bin by
 adding /apps/python39/qt-dlls.pth file with os.add_dll_directory('path-
 to-/apps/qt5/bin')

 For the installed branch of QGIS Python to work directly as well
 (referring the last issue conversation, this is only applicable when there
 is only one ltr/non-ltr branch in same root directory):

 - Patch the site-packages to include the installed branch of QGIS
   - Add a qgis.pth file with os.add_dll_directory('path-to-/apps/<qgis or
 qgis-ltr>/bin, and plain sys.path addition for /apps/<qgis or qgis-
 ltr>/python

 With this workflow we never need to add anything to PATH or environment
 (since we might have multiple installations on the same machine), and
 venvs work automatically when using /apps/python39/python.exe directly.
-- 
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/814#comment:1>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.


More information about the osgeo4w-dev mailing list