最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python 3.10 - rasterio (v1.3.4) installation fails in Ubuntu 22.04 - Stack Overflow

programmeradmin1浏览0评论

I'm getting an unexpected error while trying to install rasterio v1.3.4 in an Ubuntu (22.04 LTS) VM running in Parallels Desktop on an M2 MacBook Air running MacOS 15.2 (Sequoia). The installation is in a Python 3.10.10 virtual env. using pip v22.3.1. The GDAL version is 3.4.1, which is the highest possible in Ubuntu 22.04. The error excerpt is below:

$ python -m pip install rasterio==1.3.4
...
Collecting rasterio==1.3.4
  Downloading rasterio-1.3.4.tar.gz (406 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 406.4/406.4 kB 599.6 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
...
Building wheels for collected packages: rasterio
  Building wheel for rasterio (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for rasterio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [463 lines of output]
      <string>:22: DeprecationWarning: pkg_resources is deprecated as an API. See .html
      INFO:root:GDAL API version obtained from gdal-config: 3.4.1
      /tmp/pip-build-env-aua6fl3f/overlay/lib/python3.10/site-packages/setuptools/_distutils/extension.py:147: UserWarning: Unknown Extension options: 'cython_compile_time_env'
        warnings.warn(msg)
      INFO:root:running bdist_wheel
      INFO:root:running build
      INFO:root:running build_py
      INFO:root:creating build/lib.linux-aarch64-cpython-310/rasterio
...
        File "/home/srm/.pyenv/versions/3.10.10/lib/python3.10/zipfile.py", line 448, in FileHeader
          header = struct.pack(structFileHeader, stringFileHeader,
      struct.error: ushort format requires 0 <= number <= (0x7fff * 2 + 1)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for rasterio
Failed to build rasterio
ERROR: Could not build wheels for rasterio, which is required to install pyproject.toml-based projects

It seems that rasterio versions >= 1.4 require GDAL >= 3.5, but in Ubuntu 22.04 GDAL only goes up to 3.4.1.

The same error occurs with other versions, e.g. v1.3.5 up to v1.3.11. I haven't tried higher or lower versions.

If anyone could possibly suggest a solution or a workaround please let me know. A environment and tools version summary is given below.

  • VM info. - Linux srm-ubuntu 6.8.0-51-generic #52~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Dec 9 15:39:17 UTC 2 aarch64 aarch64 aarch64 GNU/Linux, Parallels Desktop v20.2.0
  • VM Python environment info. - Python 3.10.10 virtual env., pip v22.3.1, setuptools v65.6.0, wheel v0.45.1
  • Host info. - M2 MacBook Air running MacOS 15.2
发布评论

评论列表(0)

  1. 暂无评论