[Osgeo4w-trac] [osgeo4w] #894: Uninstalling python3-shapely package doesn't completely removes all related folders and files and then QGIS starts without Python support

OSGeo4W trac_osgeo4w at osgeo.org
Tue Oct 7 11:04:07 PDT 2025


#894: Uninstalling python3-shapely package doesn't completely removes all related
folders and files and then QGIS starts without Python support
------------------------+----------------------------
Reporter:  andreaerdna  |       Owner:  osgeo4w-dev@…
    Type:  defect       |      Status:  new
Priority:  normal       |   Component:  Package
 Version:               |  Resolution:
Keywords:               |
------------------------+----------------------------
Description changed by andreaerdna:

Old description:

> 1. install the qgis-ltr module (the python3-shapely package is correctly
> not automatically installed)
> 2. start QGIS -> QGIS starts correctly
> 3. close QGIS
> 4. install the python3-shapely module
> 5. start QGIS -> QGIS starts correctly
> 6. close QGIS
> 5. uninstall the python3-shapely module
> 6. start QGIS -> see the following error:
>

> {{{
> Couldn't load SIP module.
> Python support will be disabled.
>

> Traceback (most recent call last):
>   File "", line 1, in
>   File "C:\OSE37B~1/apps/qgis-ltr/./python\qgis\__init__.py", line 85, in
>     import qgis.gui
>   File "C:\OSE37B~1/apps/qgis-ltr/./python\qgis\gui\__init__.py", line
> 26, in
>     from qgis.core import Qgis as _Qgis
>   File "C:\OSE37B~1/apps/qgis-ltr/./python\qgis\core\__init__.py", line
> 22903, in
>     def _geometry_as_shapely(self) -> _sg.base.BaseGeometry:
>                                       ^^^^^^^^
> AttributeError: module 'shapely.geometry' has no attribute 'base'
>

> Python version:
> 3.12.11 (main, Jun 17 2025, 13:41:12) [MSC v.1943 64 bit (AMD64)]
>
> QGIS version:
> 3.40.11-Bratislava 'Bratislava', df059ed19c
>
> Python path:
> ['C:/OSE37B~1/apps/qgis-ltr/./python',
> 'C:/Users/Andrea/AppData/Roaming/QGIS/QGIS3\\profiles\\qgis340ltr_E/python',
> 'C:/Users/Andrea/AppData/Roaming/QGIS/QGIS3\\profiles\\qgis340ltr_E/python/plugins',
> 'C:/OSE37B~1/apps/qgis-ltr/./python/plugins',
> 'C:\\OSE37B~1\\apps\\grass\\grass84\\etc\\python',
> 'C:\\Users\\Andrea\\Documents', 'C:\\OSGeo4W_V2_E\\bin\\python312.zip',
> 'C:\\OSE37B~1\\apps\\Python312\\DLLs',
> 'C:\\OSE37B~1\\apps\\Python312\\Lib', 'C:\\OSGeo4W_V2_E\\bin',
> 'C:\\OSE37B~1\\apps\\Python312', 'C:\\OSE37B~1\\apps\\Python312\\Lib
> \\site-packages', 'C:\\OSE37B~1\\apps\\Python312\\Lib\\site-
> packages\\win32', 'C:\\OSE37B~1\\apps\\Python312\\Lib\\site-
> packages\\win32\\lib', 'C:\\OSE37B~1\\apps\\Python312\\Lib\\site-
> packages\\Pythonwin']
> }}}
>
> It looks like the issue is due to the fact that, uninstalling the
> python3-shapely package, the files and folders related to the "shapely"
> Python module are incorrectly non removed from the \Python312\Lib\site-
> packages folder.
>
> In fact, after the python3-shapely package in uninstalled, the "shapely"
> folder, containing other subfolders and various *.pyc files, is still
> present in the \Python312\Lib\site-packages folder.
>
> Removing the "shapely" folder and the contained files and subfolders,
> prevents the issue to occur.
>
> See also https://trac.osgeo.org/osgeo4w/ticket/871.

New description:

 1. install the qgis-ltr module (the python3-shapely package is correctly
 not automatically installed)
 2. start QGIS -> QGIS starts correctly
 3. close QGIS
 4. install the python3-shapely module
 5. start QGIS -> QGIS starts correctly
 6. close QGIS
 5. uninstall the python3-shapely module
 6. start QGIS -> see the following error:


 {{{
 Couldn't load SIP module.
 Python support will be disabled.


 Traceback (most recent call last):
   File "", line 1, in
   File "C:\OSE37B~1/apps/qgis-ltr/./python\qgis\__init__.py", line 85, in
     import qgis.gui
   File "C:\OSE37B~1/apps/qgis-ltr/./python\qgis\gui\__init__.py", line 26,
 in
     from qgis.core import Qgis as _Qgis
   File "C:\OSE37B~1/apps/qgis-ltr/./python\qgis\core\__init__.py", line
 22903, in
     def _geometry_as_shapely(self) -> _sg.base.BaseGeometry:
                                       ^^^^^^^^
 AttributeError: module 'shapely.geometry' has no attribute 'base'


 Python version:
 3.12.11 (main, Jun 17 2025, 13:41:12) [MSC v.1943 64 bit (AMD64)]

 QGIS version:
 3.40.11-Bratislava 'Bratislava', df059ed19c

 Python path:
 ['C:/OSE37B~1/apps/qgis-ltr/./python',
 'C:/Users/Andrea/AppData/Roaming/QGIS/QGIS3\\profiles\\qgis340ltr_E/python',
 'C:/Users/Andrea/AppData/Roaming/QGIS/QGIS3\\profiles\\qgis340ltr_E/python/plugins',
 'C:/OSE37B~1/apps/qgis-ltr/./python/plugins',
 'C:\\OSE37B~1\\apps\\grass\\grass84\\etc\\python',
 'C:\\Users\\Andrea\\Documents', 'C:\\OSGeo4W_V2_E\\bin\\python312.zip',
 'C:\\OSE37B~1\\apps\\Python312\\DLLs',
 'C:\\OSE37B~1\\apps\\Python312\\Lib', 'C:\\OSGeo4W_V2_E\\bin',
 'C:\\OSE37B~1\\apps\\Python312', 'C:\\OSE37B~1\\apps\\Python312\\Lib
 \\site-packages', 'C:\\OSE37B~1\\apps\\Python312\\Lib\\site-
 packages\\win32', 'C:\\OSE37B~1\\apps\\Python312\\Lib\\site-
 packages\\win32\\lib', 'C:\\OSE37B~1\\apps\\Python312\\Lib\\site-
 packages\\Pythonwin']
 }}}

 It looks like the issue is due to the fact that, uninstalling the
 python3-shapely package, the files and folders related to the "shapely"
 Python module are incorrectly non removed from the \Python312\Lib\site-
 packages folder.

 In fact, after the python3-shapely package in uninstalled, the "shapely"
 folder, containing other subfolders and various *.pyc files, is still
 present in the \Python312\Lib\site-packages folder.

 Removing the "shapely" folder and the contained files and subfolders,
 prevents the issue to occur.

 See also #871.

--
-- 
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/894#comment:2>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.


More information about the Osgeo4w-trac mailing list