jcrist / msgspec

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
https://jcristharif.com/msgspec/
BSD 3-Clause "New" or "Revised" License
2.44k stars 75 forks source link

Doesn't install on python 3.13 #741

Closed yc2984 closed 1 month ago

yc2984 commented 1 month ago

Description

OS: macOS Sonoma 14.6.1 Python 3.13.

pip install msgspec
Collecting msgspec
  Downloading msgspec-0.18.6.tar.gz (216 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: msgspec
  Building wheel for msgspec (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for msgspec (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/msgpack.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/_version.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/__init__.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/yaml.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/structs.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/inspect.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/_json_schema.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/json.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/_utils.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/toml.py -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/msgpack.pyi -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/__init__.pyi -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/json.pyi -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/structs.pyi -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      copying msgspec/py.typed -> build/lib.macosx-10.13-universal2-cpython-313/msgspec
      UPDATING build/lib.macosx-10.13-universal2-cpython-313/msgspec/_version.py
      set build/lib.macosx-10.13-universal2-cpython-313/msgspec/_version.py to '0.18.6'
      running build_ext
      building 'msgspec._core' extension
      creating build/temp.macosx-10.13-universal2-cpython-313/msgspec
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 "-I/Users/yangcao/Library/Mobile Documents/com~apple~CloudDocs/Repositories/monorepo/ewx-root/context/ewx-opsy/.venv/include" -I/Library/Frameworks/Python.framework/Versions/3.13/include/python3.13 -c msgspec/_core.c -o build/temp.macosx-10.13-universal2-cpython-313/msgspec/_core.o
      msgspec/_core.c:500:13: error: call to undeclared function '_PyUnicode_EQ'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        500 |         if (_PyUnicode_EQ(kwname, key)) {
            |             ^
      msgspec/_core.c:4452:12: error: call to undeclared function '_PySet_NextEntry'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
       4452 |     while (_PySet_NextEntry(state->structs_set, &set_pos, &set_item, &set_hash)) {
            |            ^
      msgspec/_core.c:7316:17: error: call to undeclared function '_PyUnicode_EQ'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
       7316 |             if (_PyUnicode_EQ(kwname, field)) {
            |                 ^
      msgspec/_core.c:7723:17: error: call to undeclared function '_PyUnicode_EQ'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
       7723 |             if (_PyUnicode_EQ(kwname, field)) goto kw_found;
            |                 ^
      msgspec/_core.c:11254:72: error: too few arguments to function call, expected 6, have 5
       11254 |     int out = _PyLong_AsByteArray((PyLongObject *)int128, buf, 16, 0, 0);
             |               ~~~~~~~~~~~~~~~~~~~                                      ^
      /Library/Frameworks/Python.framework/Versions/3.13/include/python3.13/cpython/longobject.h:111:17: note: '_PyLong_AsByteArray' declared here
        111 | PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
            |                 ^                   ~~~~~~~~~~~~~~~~
        112 |     unsigned char* bytes, size_t n,
            |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        113 |     int little_endian, int is_signed, int with_exceptions);
            |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      msgspec/_core.c:12426:12: error: call to undeclared function '_PySet_NextEntry'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
       12426 |     while (_PySet_NextEntry(obj, &ppos, &item, &hash)) {
             |            ^
      msgspec/_core.c:13748:12: error: call to undeclared function '_PySet_NextEntry'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
       13748 |     while (_PySet_NextEntry(obj, &ppos, &item, &hash)) {
             |            ^
      7 errors generated.
      error: command '/usr/local/opt/llvm/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 msgspec
Failed to build msgspec
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (msgspec)
dnso86 commented 1 month ago

Similar problem on Fedora 41.

  × Building wheel for msgspec (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/__init__.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/_json_schema.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/_utils.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/_version.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/inspect.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/json.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/msgpack.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/structs.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/toml.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/yaml.py -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/__init__.pyi -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/json.pyi -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/msgpack.pyi -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/structs.pyi -> build/lib.linux-x86_64-cpython-313/msgspec
      copying msgspec/py.typed -> build/lib.linux-x86_64-cpython-313/msgspec
      warning: cmd_build_py: byte-compiling is disabled, skipping.

      UPDATING build/lib.linux-x86_64-cpython-313/msgspec/_version.py
      set build/lib.linux-x86_64-cpython-313/msgspec/_version.py to '0.18.5'
      running build_ext
      building 'msgspec._core' extension
      creating build/temp.linux-x86_64-cpython-313/msgspec
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -O3 -fPIC -I/opt/venv/include -I/usr/include/python3.13 -c msgspec/_core.c -o build/temp.linux-x86_64-cpython-313/msgspec/_core.o
      msgspec/_core.c: In function ‘find_keyword’:
      msgspec/_core.c:499:13: error: implicit declaration of function ‘_PyUnicode_EQ’; did you mean ‘PyUnicode_New’? [-Wimplicit-function-declaration]
        499 |         if (_PyUnicode_EQ(kwname, key)) {
            |             ^~~~~~~~~~~~~
            |             PyUnicode_New
      msgspec/_core.c: In function ‘typenode_collect_convert_structs’:
      msgspec/_core.c:4260:12: error: implicit declaration of function ‘_PySet_NextEntry’ [-Wimplicit-function-declaration]
       4260 |     while (_PySet_NextEntry(state->structs_set, &set_pos, &set_item, &set_hash)) {
            |            ^~~~~~~~~~~~~~~~
      msgspec/_core.c: In function ‘ms_uuid_to_16_bytes’:
      msgspec/_core.c:10874:15: error: too few arguments to function ‘_PyLong_AsByteArray’
      10874 |     int out = _PyLong_AsByteArray((PyLongObject *)int128, buf, 16, 0, 0);
            |               ^~~~~~~~~~~~~~~~~~~
      In file included from /usr/include/python3.13/longobject.h:107,
                       from /usr/include/python3.13/Python.h:81,
                       from msgspec/_core.c:9:
      /usr/include/python3.13/cpython/longobject.h:111:17: note: declared here
        111 | PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
            |                 ^~~~~~~~~~~~~~~~~~~
      error: command '/usr/bin/gcc' 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 msgspec
JacobCoffee commented 1 month ago

Dupe of https://github.com/jcrist/msgspec/issues/698