dantrim / hamming-codec

Simple encode/decode utilties for bit-error correcting Hamming codes
MIT License
14 stars 4 forks source link

Python3.11 issues? #19

Open danaki opened 1 year ago

danaki commented 1 year ago

The issue is similar to this https://github.com/sirfz/tesserocr/issues/298 While pip-installing hamming-codec package getting

      FAILED: src/python/CMakeFiles/_hamming_codec.dir/module.cpp.o
      /Library/Developer/CommandLineTools/usr/bin/c++ -DVERSION_INFO=\"0.3.5\" -D_hamming_codec_EXPORTS -I/private/var/folders/0l/styprx3j7fs1j3n98vfr2yw00000gn/T/pip-install-fbbxpb05/hamming-codec_45560b7b08e74e298a8133ce04269e96/src/cpp -isystem /private/var/folders/0l/styprx3j7fs1j3n98vfr2yw00000gn/T/pip-install-fbbxpb05/hamming-codec_45560b7b08e74e298a8133ce04269e96/exts/pybind11/include -isystem /Users/jurijspimenovs/anaconda3/envs/gs/include/python3.11 -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -mmacosx-version-min=13.0 -fPIC -fvisibility=hidden -flto -MD -MT src/python/CMakeFiles/_hamming_codec.dir/module.cpp.o -MF src/python/CMakeFiles/_hamming_codec.dir/module.cpp.o.d -o src/python/CMakeFiles/_hamming_codec.dir/module.cpp.o -c /private/var/folders/0l/styprx3j7fs1j3n98vfr2yw00000gn/T/pip-install-fbbxpb05/hamming-codec_45560b7b08e74e298a8133ce04269e96/src/python/module.cpp
      In file included from /private/var/folders/0l/styprx3j7fs1j3n98vfr2yw00000gn/T/pip-install-fbbxpb05/hamming-codec_45560b7b08e74e298a8133ce04269e96/src/python/module.cpp:1:
      In file included from /private/var/folders/0l/styprx3j7fs1j3n98vfr2yw00000gn/T/pip-install-fbbxpb05/hamming-codec_45560b7b08e74e298a8133ce04269e96/exts/pybind11/include/pybind11/pybind11.h:45:
      In file included from /private/var/folders/0l/styprx3j7fs1j3n98vfr2yw00000gn/T/pip-install-fbbxpb05/hamming-codec_45560b7b08e74e298a8133ce04269e96/exts/pybind11/include/pybind11/attr.h:13:
      /private/var/folders/0l/styprx3j7fs1j3n98vfr2yw00000gn/T/pip-install-fbbxpb05/hamming-codec_45560b7b08e74e298a8133ce04269e96/exts/pybind11/include/pybind11/cast.h:446:36: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                      "  " + handle(frame->f_code->co_filename).cast<std::string>() +
                                         ^
      /Users/jurijspimenovs/anaconda3/envs/gs/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;

My Python is 3.11.3, on Apple Silicon M1.

NoelJames commented 9 months ago

same issue My Python is 3.11.3, on Mac Intel

matlupi commented 8 months ago

Same here on Python 3.11.6 on docker (Alpine 3.18).

fegennari commented 1 month ago

Hamming-codec doesn't build on Python 3.11 or 3.12 because the python API has changed. Updating to the latest pybind11 (2.12.0) should fix it.

diff --git a/exts/pybind11 b/exts/pybind11 index 79b0e2c..aa98d95 160000 --- a/exts/pybind11 +++ b/exts/pybind11 @@ -1 +1 @@ -Subproject commit 79b0e2c05206865fe12a1ef95552e059913c1855 +Subproject commit aa98d95717d1365b5c32d3942abd0292fbd19021

fegennari commented 1 month ago

Here, try my fork: https://github.com/fegennari/hamming-codec This is tested and working with Python 3.12 and will probably work with 3.11 as well.