pytries / marisa-trie

Static memory-efficient Trie-like structures for Python based on marisa-trie C++ library.
https://marisa-trie.readthedocs.io/en/latest/
MIT License
1.02k stars 91 forks source link

Seems like python 3.12 is not supported #93

Closed obaltian closed 9 months ago

obaltian commented 9 months ago

Hello. Recently I tried to bump python to 3.12 in my project, but got following poetry errors during dependencies installation. I am using arm64, if it's important.

So, is the python 3.12 supported?

  • Installing marisa-trie (0.7.8): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  running bdist_wheel
  running build
  running build_clib
  building 'libmarisa-trie' library
  creating build
  creating build/temp.macosx-14-arm64-cpython-312
  creating build/temp.macosx-14-arm64-cpython-312/marisa-trie
  creating build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib
  creating build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa
  creating build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire
  creating build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/io
  creating build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/trie
  creating build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/vector
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/agent.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/agent.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/grimoire/io/mapper.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/io/mapper.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/grimoire/io/reader.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/io/reader.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/grimoire/io/writer.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/io/writer.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/grimoire/trie/louds-trie.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/trie/louds-trie.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/grimoire/trie/tail.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/trie/tail.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/grimoire/vector/bit-vector.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/vector/bit-vector.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/keyset.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/keyset.o
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/lib -Imarisa-trie/include -c marisa-trie/lib/marisa/trie.cc -o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/trie.o
  /usr/bin/xcrun ar rcs build/temp.macosx-14-arm64-cpython-312/liblibmarisa-trie.a build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/agent.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/io/mapper.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/io/reader.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/io/writer.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/trie/louds-trie.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/trie/tail.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/grimoire/vector/bit-vector.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/keyset.o build/temp.macosx-14-arm64-cpython-312/marisa-trie/lib/marisa/trie.o
  ranlib build/temp.macosx-14-arm64-cpython-312/liblibmarisa-trie.a
  running build_ext
  building 'marisa_trie' extension
  creating build/temp.macosx-14-arm64-cpython-312/src
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Imarisa-trie/include -I/private/var/folders/82/shvhkdb51rb7_s34yld2pst00000gn/T/tmpeetivgwk/.venv/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/agent.cpp -o build/temp.macosx-14-arm64-cpython-312/src/agent.o
  src/agent.cpp:1582:27: warning: 'ma_version_tag' is deprecated [-Wdeprecated-declarations]
      return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
                            ^
  src/agent.cpp:1046:65: note: expanded from macro '__PYX_GET_DICT_VERSION'
  #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
                                                                  ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/cpython/dictobject.h:22:5: note: 'ma_version_tag' has been explicitly marked deprecated here
      Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/pyport.h:317:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  src/agent.cpp:1594:36: warning: 'ma_version_tag' is deprecated [-Wdeprecated-declarations]
      return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
                                     ^
  src/agent.cpp:1046:65: note: expanded from macro '__PYX_GET_DICT_VERSION'
  #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
                                                                  ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/cpython/dictobject.h:22:5: note: 'ma_version_tag' has been explicitly marked deprecated here
      Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/pyport.h:317:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  src/agent.cpp:1598:56: warning: 'ma_version_tag' is deprecated [-Wdeprecated-declarations]
      if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
                                                         ^
  src/agent.cpp:1046:65: note: expanded from macro '__PYX_GET_DICT_VERSION'
  #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
                                                                  ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/cpython/dictobject.h:22:5: note: 'ma_version_tag' has been explicitly marked deprecated here
      Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/pyport.h:317:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  src/agent.cpp:1657:9: warning: 'ma_version_tag' is deprecated [-Wdeprecated-declarations]
          __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
          ^
  src/agent.cpp:1053:16: note: expanded from macro '__PYX_PY_DICT_LOOKUP_IF_MODIFIED'
      if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
                 ^
  src/agent.cpp:1046:65: note: expanded from macro '__PYX_GET_DICT_VERSION'
  #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
                                                                  ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/cpython/dictobject.h:22:5: note: 'ma_version_tag' has been explicitly marked deprecated here
      Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/pyport.h:317:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  src/agent.cpp:1657:9: warning: 'ma_version_tag' is deprecated [-Wdeprecated-declarations]
          __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
          ^
  src/agent.cpp:1057:30: note: expanded from macro '__PYX_PY_DICT_LOOKUP_IF_MODIFIED'
          __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
                               ^
  src/agent.cpp:1046:65: note: expanded from macro '__PYX_GET_DICT_VERSION'
  #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
                                                                  ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/cpython/dictobject.h:22:5: note: 'ma_version_tag' has been explicitly marked deprecated here
      Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      ^
  /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12/pyport.h:317:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  src/agent.cpp:1958:55: error: no member named 'ob_digit' in '_longobject'
              const digit* digits = ((PyLongObject*)x)->ob_digit;
                                    ~~~~~~~~~~~~~~~~~~  ^
  src/agent.cpp:2013:55: error: no member named 'ob_digit' in '_longobject'
              const digit* digits = ((PyLongObject*)x)->ob_digit;
                                    ~~~~~~~~~~~~~~~~~~  ^
  src/agent.cpp:2154:55: error: no member named 'ob_digit' in '_longobject'
              const digit* digits = ((PyLongObject*)x)->ob_digit;
                                    ~~~~~~~~~~~~~~~~~~  ^
  src/agent.cpp:2209:55: error: no member named 'ob_digit' in '_longobject'
              const digit* digits = ((PyLongObject*)x)->ob_digit;
                                    ~~~~~~~~~~~~~~~~~~  ^
  src/agent.cpp:2660:47: error: no member named 'ob_digit' in '_longobject'
      const digit* digits = ((PyLongObject*)b)->ob_digit;
                            ~~~~~~~~~~~~~~~~~~  ^
  5 warnings and 5 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1

  at ~/Library/Application Support/pypoetry/venv/lib/python3.12/site-packages/poetry/installation/chef.py:147 in _prepare
      143│ 
      144│                 error = ChefBuildError("\n\n".join(message_parts))
      145│ 
      146│             if error is not None:
    → 147│                 raise error from None
      148│ 
      149│             return path
      150│ 
      151│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with marisa-trie (0.7.8) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "marisa-trie (==0.7.8)"'.
BoboTiG commented 9 months ago

Python 3.12 is not yet supported. I'll have a look ASAP, or if you want to step in, go ahead too :)

BoboTiG commented 9 months ago

And voilà: version 1.1.0 does support Python 3.12 🎉

obaltian commented 9 months ago

@BoboTiG you didn't leave any time for me to look inside xd