browsermt / bergamot-translator

Cross platform C++ library focusing on optimized machine translation on the consumer-grade device.
http://browser.mt
Mozilla Public License 2.0
341 stars 38 forks source link

Issue installing Python bindings with bundled version of pybind11 #473

Open bunburya opened 2 months ago

bunburya commented 2 months ago

I was having issues installing the Python bindings on ArchLinux using Python 3.12 (using pip install .). The output is long but this seems to be the pertinent issue:

      In file included from /home/alan/bergamot-translator/3rd_party/pybind11/include/pybind11/cast.h:16,
                       from /home/alan/bergamot-translator/3rd_party/pybind11/include/pybind11/attr.h:13,
                       from /home/alan/bergamot-translator/3rd_party/pybind11/include/pybind11/pybind11.h:13,
                       from /home/alan/bergamot-translator/3rd_party/pybind11/include/pybind11/iostream.h:22,
                       from /home/alan/bergamot-translator/bindings/python/bergamot.cpp:1:
      /home/alan/bergamot-translator/3rd_party/pybind11/include/pybind11/detail/type_caster_base.h: In function ‘std::string pybind11::detail::error_string()’:
      /home/alan/bergamot-translator/3rd_party/pybind11/include/pybind11/detail/type_caster_base.h:482:26: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        482 |             frame = frame->f_back;
            |                          ^~

Using my current system version of pybind11 (2.13.5) fixes the issue. I also tested installation with v2.13.5 in Python 3.10 and 3.8 and it works as well. So I would suggest shipping with that version.