[gdal-dev] gdal docker with numpy2-compatible python bindings
Vincent Schut
schut at satelligence.com
Fri Jul 12 07:00:46 PDT 2024
Hi, the current gdal-ubuntu-small docker (3.9.1) appears to have python
bindings that are not compatible with numpy 2.0.0. If I pip install
--upgrade numpy==2.0.0 and then try `from osgeo import gdal, gdal_array`
I get an error:
In [4]: from osgeo import gdal, gdal_array
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "/root/.local/bin/ipython",
line 8, in <module>
sys.exit(start_ipython())
File "/root/.local/lib/python3.12/site-packages/IPython/__init__.py",
line 130, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File
"/root/.local/lib/python3.12/site-packages/traitlets/config/application.py",
line 1075, in launch_instance
app.start()
File
"/root/.local/lib/python3.12/site-packages/IPython/terminal/ipapp.py",
line 317, in start
self.shell.mainloop()
File
"/root/.local/lib/python3.12/site-packages/IPython/terminal/interactiveshell.py",
line 917, in mainloop
self.interact()
File
"/root/.local/lib/python3.12/site-packages/IPython/terminal/interactiveshell.py",
line 910, in interact
self.run_cell(code, store_history=True)
File
"/root/.local/lib/python3.12/site-packages/IPython/core/interactiveshell.py",
line 3075, in run_cell
result = self._run_cell(
File
"/root/.local/lib/python3.12/site-packages/IPython/core/interactiveshell.py",
line 3130, in _run_cell
result = runner(coro)
File
"/root/.local/lib/python3.12/site-packages/IPython/core/async_helpers.py",
line 128, in _pseudo_sync_runner
coro.send(None)
File
"/root/.local/lib/python3.12/site-packages/IPython/core/interactiveshell.py",
line 3334, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File
"/root/.local/lib/python3.12/site-packages/IPython/core/interactiveshell.py",
line 3517, in run_ast_nodes
if await self.run_code(code, result, async_=asy):
File
"/root/.local/lib/python3.12/site-packages/IPython/core/interactiveshell.py",
line 3577, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-dd0a9b2f852a>", line 1, in <module>
from osgeo import gdal, gdal_array
File "/usr/lib/python3/dist-packages/osgeo/gdal_array.py", line 10,
in <module>
from . import _gdal_array
I hoped that the python bindings in the docker image would be compatible
with both numpy 1 and 2, but apparently they're not? Would it be
possible to create docker images with bindings that are compatible with
numpy2? Or would you rather wait until the official ubuntu numpy package
moves to 2.0?
Thanks,
--
Vincent Schut
Remote Sensing Software Engineer
+31 302272679 ~ Maliebaan 22 | 3581CP | Utrecht | Netherlands
Linkedin <https://www.linkedin.com/company/satelligence/>~
satelligence.com <http://www.satelligence.com><http://www.satelligence.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240712/a0551b4c/attachment.htm>
More information about the gdal-dev
mailing list