Opened 4 months ago

Closed 3 months ago

#819 closed defect (fixed)

Cannot import both pyarrow and osgeo in OSGeo4W shell

Reported by: jontwo Owned by: osgeo4w-dev@…
Priority: normal Component: Package
Version: Keywords:
Cc:

Description (last modified by jef)

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 version3.34.4-Prizren
QGIS code revisiondecd43dc
Qt version5.15.3
Python version3.9.18
GDAL/OGR version3.8.4
PROJ version9.3.1
EPSG Registry database versionv10.098 (2023-11-24)
GEOS version3.12.1-CAPI-1.18.1
SQLite version3.41.1
PDAL version2.6.0
PostgreSQL client version16.1
SpatiaLite version5.1.0
QWT version6.1.6
QScintilla2 version2.13.4
OS version Windows 10 Version 2009

Change History (4)

comment:1 by jef, 4 months ago

pyarrow is not part of OSGeo4W. To add it you probably have to build it against OSGeo4W's arrow (like GDAL).

comment:2 by jontwo, 4 months ago

It's one of our requirements - I've pip installed it and it seems to otherwise work fine.

comment:3 by jef, 4 months ago

Description: modified (diff)

comment:4 by jef, 3 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.