[osgeo4w-dev] [osgeo4w] #819: Cannot import both pyarrow and osgeo in OSGeo4W shell

OSGeo4W trac_osgeo4w at osgeo.org
Wed Mar 13 10:08:35 PDT 2024


#819: Cannot import both pyarrow and osgeo in OSGeo4W shell
-------------------+----------------------------
Reporter:  jontwo  |       Owner:  osgeo4w-dev@…
    Type:  defect  |      Status:  new
Priority:  normal  |   Component:  Package
 Version:          |  Resolution:
Keywords:          |
-------------------+----------------------------
Description changed by jef:

Old description:

> The latest version of dask was causing an import error, but on further
> investigation it turns out that pyarrow and GDAL cannot be installed at
> the same time.
>
> Repro case: importing on the command line, both libraries can be imported
> individually, but not together. You get a different error depending on
> the import order.
>

> {{{
>
> c:\>python -c "import pyarrow"
>
> c:\>python -c "import osgeo"
>
> c:\>python -c "import pyarrow;import osgeo"
> Traceback (most recent call last):
>   File "C:\OSGeo4W\apps\Python39\lib\site-packages\osgeo\__init__.py",
> line 30, in swig_import_helper
>     return importlib.import_module(mname)
>   File "C:\OSGeo4W\apps\Python39\lib\importlib\__init__.py", line 127, in
> import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
>   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
>   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 986, in
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
>   File "<frozen importlib._bootstrap>", line 565, in module_from_spec
>   File "<frozen importlib._bootstrap_external>", line 1173, in
> create_module
>   File "<frozen importlib._bootstrap>", line 228, in
> _call_with_frames_removed
> ImportError: DLL load failed while importing _gdal: The specified
> procedure could not be found.
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "C:\OSGeo4W\apps\Python39\lib\site-packages\osgeo\__init__.py",
> line 35, in <module>
>     _gdal = swig_import_helper()
>   File "C:\OSGeo4W\apps\Python39\lib\site-packages\osgeo\__init__.py",
> line 32, in swig_import_helper
>     return importlib.import_module('_gdal')
>   File "C:\OSGeo4W\apps\Python39\lib\importlib\__init__.py", line 127, in
> import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
> ModuleNotFoundError: No module named '_gdal'
>
> c:\>python -c "import osgeo;import pyarrow"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "C:\OSGeo4W\apps\Python39\lib\site-packages\pyarrow\__init__.py",
> line 65, in <module>
>     import pyarrow.lib as _lib
> ImportError: DLL load failed while importing lib: The specified procedure
> could not be found.
>
> }}}
>
> System information:
>

> QGIS version
> 3.34.4-Prizren
> QGIS code revision
> decd43dc
> Qt version
> 5.15.3
> Python version
> 3.9.18
> GDAL/OGR version
> 3.8.4
> PROJ version
> 9.3.1
> EPSG Registry database version
> v10.098 (2023-11-24)
> GEOS version
> 3.12.1-CAPI-1.18.1
> SQLite version
> 3.41.1
> PDAL version
> 2.6.0
> PostgreSQL client version
> 16.1
> SpatiaLite version
> 5.1.0
> QWT version
> 6.1.6
> QScintilla2 version
> 2.13.4
> OS version
> Windows 10 Version 2009

New description:

 The latest version of dask was causing an import error, but on further
 investigation it turns out that pyarrow and GDAL cannot be installed at
 the same time.

 Repro case: importing on the command line, both libraries can be imported
 individually, but not together. You get a different error depending on the
 import order.


 {{{

 c:\>python -c "import pyarrow"

 c:\>python -c "import osgeo"

 c:\>python -c "import pyarrow;import osgeo"
 Traceback (most recent call last):
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\osgeo\__init__.py",
 line 30, in swig_import_helper
     return importlib.import_module(mname)
   File "C:\OSGeo4W\apps\Python39\lib\importlib\__init__.py", line 127, in
 import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
   File "<frozen importlib._bootstrap>", line 986, in
 _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
   File "<frozen importlib._bootstrap>", line 565, in module_from_spec
   File "<frozen importlib._bootstrap_external>", line 1173, in
 create_module
   File "<frozen importlib._bootstrap>", line 228, in
 _call_with_frames_removed
 ImportError: DLL load failed while importing _gdal: The specified
 procedure could not be found.

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\osgeo\__init__.py",
 line 35, in <module>
     _gdal = swig_import_helper()
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\osgeo\__init__.py",
 line 32, in swig_import_helper
     return importlib.import_module('_gdal')
   File "C:\OSGeo4W\apps\Python39\lib\importlib\__init__.py", line 127, in
 import_module
     return _bootstrap._gcd_import(name[level:], package, level)
 ModuleNotFoundError: No module named '_gdal'

 c:\>python -c "import osgeo;import pyarrow"
 Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\pyarrow\__init__.py",
 line 65, in <module>
     import pyarrow.lib as _lib
 ImportError: DLL load failed while importing lib: The specified procedure
 could not be found.

 }}}

 System information:


 ||QGIS version||3.34.4-Prizren||
 ||QGIS code revision||decd43dc||
 ||Qt version||5.15.3||
 ||Python version||3.9.18||
 ||GDAL/OGR version||3.8.4||
 ||PROJ version||9.3.1||
 ||EPSG Registry database version||v10.098 (2023-11-24)||
 ||GEOS version||3.12.1-CAPI-1.18.1||
 ||SQLite version||3.41.1||
 ||PDAL version||2.6.0||
 ||PostgreSQL client version||16.1||
 ||!SpatiaLite version||5.1.0||
 ||QWT version||6.1.6||
 ||QScintilla2 version||2.13.4||
 ||OS version || Windows 10 Version 2009 ||

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