[osgeo4w-dev] [osgeo4w] #692: Python 3.9 on v2 installer breaks part of stdlib

OSGeo4W trac_osgeo4w at osgeo.org
Wed Sep 29 05:06:59 PDT 2021

#692: Python 3.9 on v2 installer breaks part of stdlib
Reporter:  akominlsfi  |       Owner:  osgeo4w-dev@…
    Type:  defect      |      Status:  new
Priority:  major       |   Component:  Installer
 Version:              |  Resolution:
Keywords:              |

Comment (by akominlsfi):

 Regarding the patching of dll directories I found this
 [https://www.python.org/dev/peps/pep-0648/ PEP #648] for site
 customizations, which seems to be what osgeo4w packaging could benefit a
 lot from (each package that gets installed and needs for example shared
 dlls could add their respective script to the directory).

 Since that PEP is still a draft, sitecustomize or a custom .pth file/files
 (using [https://docs.python.org/3/library/site.html site module]) could be
 way to go for now regarding the patching of dll directories? Location of
 these could be in site-packages or next to the `apps/python37/python.exe`.
 Creating a venv without the `--system-site-packages` flag needs the
 patching anyway if stdlib dlls are not duplicated (for ssl and sqlite3 to
 work), so the customization could be done always by using the exe path.

 This change should preserve the current usage (osgeo4w shell, python-
 qgis.bats, anything else?) and also the python environment would work now
 as a standalone installation directly from the exe that just happens to
 include a lot of stuff in system site-packages without any special preset
 environment needed before execution.

 Side note: It could also help if the QGIS install added a .pth file to the
 site-packages. The module is currently resolved by the wrapper bat
 extending PYTHONPATH to include `apps/qgis/python`, but since `import
 qgis` now works if its found at all even if the wrapper bat is not used
 (fixed [https://github.com/qgis/QGIS/pull/43345 here]), it could be used
 as if it was a normal site-package in the python environment with the help
 of a .pth file pointing to the module path.

Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/692#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