indygreg / python-zstandard

Python bindings to the Zstandard (zstd) compression library
BSD 3-Clause "New" or "Revised" License
481 stars 83 forks source link

Failed building wheel for zstandard: Mac M2 #197

Closed ryanhughes-motional closed 1 year ago

ryanhughes-motional commented 1 year ago

Hey all.

I'm trying to install zstandard, but getting this issue. Any ideas?

Building wheels for collected packages: zstandard, lazy-object-proxy
  Building wheel for zstandard (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for zstandard (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/zstandard
      copying zstandard/cffi.py -> build/lib.macosx-13-arm64-cpython-311/zstandard
      copying zstandard/__init__.py -> build/lib.macosx-13-arm64-cpython-311/zstandard
      running build_ext
      building 'zstd' extension
      creating build/temp.macosx-13-arm64-cpython-311
      creating build/temp.macosx-13-arm64-cpython-311/c-ext
      creating build/temp.macosx-13-arm64-cpython-311/zstd
      creating build/temp.macosx-13-arm64-cpython-311/zstd/common
      creating build/temp.macosx-13-arm64-cpython-311/zstd/compress
      creating build/temp.macosx-13-arm64-cpython-311/zstd/decompress
      creating build/temp.macosx-13-arm64-cpython-311/zstd/dictBuilder
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -Ic-ext -Izstd/compress -Izstd/common -Izstd/decompress -Izstd/dictBuilder -Izstd -I/my_repository/backend_venv/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c c-ext/bufferutil.c -o build/temp.macosx-13-arm64-cpython-311/c-ext/bufferutil.o -DZSTD_MULTITHREAD -DZSTDLIB_VISIBILITY= -DZDICTLIB_VISIBILITY= -DZSTDERRORLIB_VISIBILITY= -fvisibility=hidden
      c-ext/bufferutil.c:761:39: error: expression is not assignable
              Py_TYPE(&ZstdBufferWithSegmentsType) = &PyType_Type;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      c-ext/bufferutil.c:769:35: error: expression is not assignable
              Py_TYPE(&ZstdBufferSegmentsType) = &PyType_Type;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      c-ext/bufferutil.c:777:34: error: expression is not assignable
              Py_TYPE(&ZstdBufferSegmentType) = &PyType_Type;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      c-ext/bufferutil.c:785:49: error: expression is not assignable
              Py_TYPE(&ZstdBufferWithSegmentsCollectionType) = &PyType_Type;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      4 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for zstandard
  Building wheel for lazy-object-proxy (pyproject.toml) ... done
  Created wheel for lazy-object-proxy: filename=lazy_object_proxy-1.9.0-cp311-cp311-macosx_13_0_arm64.whl size=23167 sha256=63ae22273371b4bb4e951ed1ad283a40b800838ffc2718d70435d93d0cb4b0c6
  Stored in directory: /Users/me/Library/Caches/pip/wheels/04/66/44/364c8d6c015510861d06b4a7881254d284901e60a7e4ec90d0
Successfully built lazy-object-proxy
Failed to build zstandard
ERROR: Could not build wheels for zstandard, which is required to install pyproject.toml-based projects
indygreg commented 1 year ago

This was fixed by commit e5a3baf61b65f3075f250f504ddad9f8612bfedf and first appears in version 0.15 of this package (released 2020-12-29).

Please upgrade to a newer version if you want Python 3.10 support. (0.16.0 was the first release uploading binary wheels for Python 3.10 and 0.15.2 was the first uploading wheels for macOS ARM.)