kylebgorman / pynini

Read-only mirror of Pynini
http://pynini.opengrm.org
Apache License 2.0
118 stars 27 forks source link

Installation fails on Raspberry Pi 4 8GB with aarch64 Bullseye #68

Closed lizaibeim closed 1 year ago

lizaibeim commented 1 year ago

Hi, I am trying to install the pynini on Raspberry Pi 8G Bulleye 64 bits, I follow the instructions to check the dependencise

A standards-compliant C++17 compiler (GCC >= 7 or Clang >= 700)
The compatible recent version of [OpenFst](http://openfst.org/) (see [NEWS](https://pypi.org/project/pynini/NEWS) for this) built with the grm extensions (i.e., built with ./configure --enable-grm) and headers
[Python 3.6+](https://www.python.org/) and headers

When I run the pip install pynini, I got such error error: invalid cast from type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to type ‘PyObject*’ {aka ‘_object*’}.

I hvae also tried git clone the repository and then run the sudo python setup.py install

The full error log during installation is shown as below

extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to type ‘PyObject*’ {aka ‘_object*’}
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |                                        ^~~~~~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:1400:43: note: in definition of macro ‘likely’
 1400 |   #define likely(x)   __builtin_expect(!!(x), 1)
      |                                           ^
/usr/include/python3.9/object.h:130:42: note: in expansion of macro ‘_PyObject_CAST_CONST’
  130 | #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
      |                                          ^~~~~~~~~~~~~~~~~~~~
/usr/include/python3.9/floatobject.h:24:32: note: in expansion of macro ‘Py_IS_TYPE’
   24 | #define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type)
      |                                ^~~~~~~~~~
extensions/_pywrapfst.cpp:3196:10: note: in expansion of macro ‘PyFloat_CheckExact’
 3196 | ((likely(PyFloat_CheckExact(obj))) ?  PyFloat_AS_DOUBLE(obj) :\
      |          ^~~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:11529:15: note: in expansion of macro ‘__Pyx_PyObject_AsDouble’
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |               ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.9/Python.h:101,
                 from extensions/_pywrapfst.cpp:46:
extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to type ‘PyObject*’ {aka ‘_object*’}
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |                                        ^~~~~~~~~~~~~~~~~~~~~
/usr/include/python3.9/floatobject.h:51:51: note: in definition of macro ‘PyFloat_AS_DOUBLE’
   51 | #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
      |                                                   ^~
extensions/_pywrapfst.cpp:11529:15: note: in expansion of macro ‘__Pyx_PyObject_AsDouble’
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |               ^~~~~~~~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to type ‘PyObject*’ {aka ‘_object*’}
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |                                        ^~~~~~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:1400:43: note: in definition of macro ‘likely’
 1400 |   #define likely(x)   __builtin_expect(!!(x), 1)
      |                                           ^
/usr/include/python3.9/object.h:130:42: note: in expansion of macro ‘_PyObject_CAST_CONST’
  130 | #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
      |                                          ^~~~~~~~~~~~~~~~~~~~
/usr/include/python3.9/longobject.h:16:31: note: in expansion of macro ‘Py_IS_TYPE’
   16 | #define PyLong_CheckExact(op) Py_IS_TYPE(op, &PyLong_Type)
      |                               ^~~~~~~~~~
extensions/_pywrapfst.cpp:3197:9: note: in expansion of macro ‘PyLong_CheckExact’
 3197 |  likely(PyLong_CheckExact(obj)) ?\
      |         ^~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:11529:15: note: in expansion of macro ‘__Pyx_PyObject_AsDouble’
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |               ^~~~~~~~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to type ‘PyObject*’ {aka ‘_object*’}
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |                                        ^~~~~~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:3198:18: note: in definition of macro ‘__Pyx_PyObject_AsDouble’
 3198 |  PyLong_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
      |                  ^~~
extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to type ‘PyObject*’ {aka ‘_object*’}
11529 |   __pyx_t_2 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
      |                                        ^~~~~~~~~~~~~~~~~~~~~
extensions/_pywrapfst.cpp:3198:50: note: in definition of macro ‘__Pyx_PyObject_AsDouble’
 3198 |  PyLong_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))

My GCC version is gcc (Debian 10.2.1-6) 10.2.1 20210110, and my python version is 3.9.2, I am trying to install openfst 1.8.2 and install pynini 2.1.5

kylebgorman commented 1 year ago

Hi; I haven't seen this before. This could be an issue with Cython (what version do you have?), your GCC version (that's reasonably old though not absurdly so), or something specific to your platform. I don't have any particular debugging ideas at present.

On Thu, Aug 3, 2023 at 5:14 PM Zaibei Eric Li @.***> wrote:

Hi, I am trying to install the pynini on Raspberry Pi 8G Bulleye 64 bits, I follow the instructions to check the dependencise

A standards-compliant C++17 compiler (GCC >= 7 or Clang >= 700) The compatible recent version of OpenFst (see NEWS for this) built with the grm extensions (i.e., built with ./configure --enable-grm) and headers Python 3.6+ and headers

When I run the pip install pynini, I got such error error: invalid cast from type ‘std::string’ {aka ‘std::__cxx11::basic_string’} to type ‘PyObject’ {aka ‘_object’}.

I hvae also tried git clone the repository and then run the sudo python setup.py install

The full error log during installation is shown as below

extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::cxx11::basic_string’} to type ‘PyObject’ {aka ‘_object’} 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject *)pyx_t_1)); if (unlikely(pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, pyx_L1_error) | ^~~~~ extensions/_pywrapfst.cpp:1400:43: note: in definition of macro ‘likely’ 1400 | #define likely(x) builtin_expect(!!(x), 1) | ^ /usr/include/python3.9/object.h:130:42: note: in expansion of macro ‘_PyObject_CAST_CONST’ 130 | #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type) | ^~~~~~~~ /usr/include/python3.9/floatobject.h:24:32: note: in expansion of macro ‘Py_IS_TYPE’ 24 | #define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type) | ^~~~~~ extensions/_pywrapfst.cpp:3196:10: note: in expansion of macro ‘PyFloat_CheckExact’ 3196 | ((likely(PyFloat_CheckExact(obj))) ? PyFloat_AS_DOUBLE(obj) :\ | ^~~~~~ extensions/_pywrapfst.cpp:11529:15: note: in expansion of macro ‘Pyx_PyObject_AsDouble’ 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject )pyx_t_1)); if (unlikely(pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 497, pyx_L1_error) | ^~~~~~~ In file included from /usr/include/python3.9/Python.h:101, from extensions/_pywrapfst.cpp:46: extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::cxx11::basic_string’} to type ‘PyObject’ {aka ‘_object’} 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject )pyx_t_1)); if (unlikely(pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) PYX_ERR(0, 497, pyx_L1_error) | ^~~~~ /usr/include/python3.9/floatobject.h:51:51: note: in definition of macro ‘PyFloat_AS_DOUBLE’ 51 | #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) | ^~ extensions/_pywrapfst.cpp:11529:15: note: in expansion of macro ‘Pyx_PyObject_AsDouble’ 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject *)pyx_t_1)); if (unlikely(pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) PYX_ERR(0, 497, pyx_L1_error) | ^~~~~~~ extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::cxx11::basic_string’} to type ‘PyObject’ {aka ‘_object’} 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject *)pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) PYX_ERR(0, 497, pyx_L1_error) | ^~~~~ extensions/_pywrapfst.cpp:1400:43: note: in definition of macro ‘likely’ 1400 | #define likely(x) builtin_expect(!!(x), 1) | ^ /usr/include/python3.9/object.h:130:42: note: in expansion of macro ‘_PyObject_CAST_CONST’ 130 | #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type) | ^~~~~~~~ /usr/include/python3.9/longobject.h:16:31: note: in expansion of macro ‘Py_IS_TYPE’ 16 | #define PyLong_CheckExact(op) Py_IS_TYPE(op, &PyLong_Type) | ^~~~~~ extensions/_pywrapfst.cpp:3197:9: note: in expansion of macro ‘PyLong_CheckExact’ 3197 | likely(PyLong_CheckExact(obj)) ?\ | ^~~~~ extensions/_pywrapfst.cpp:11529:15: note: in expansion of macro ‘Pyx_PyObject_AsDouble’ 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject *)pyx_t_1)); if (unlikely(pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) PYX_ERR(0, 497, pyx_L1_error) | ^~~~~~~ extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::cxx11::basic_string’} to type ‘PyObject’ {aka ‘_object’} 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject *)pyx_t_1)); if (unlikely(__pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) PYX_ERR(0, 497, pyx_L1_error) | ^~~~~ extensions/_pywrapfst.cpp:3198:18: note: in definition of macro ‘__Pyx_PyObject_AsDouble’ 3198 | PyLong_AsDouble(obj) : PyxPyObject_AsDouble(obj)) | ^~~ extensions/_pywrapfst.cpp:11529:40: error: invalid cast from type ‘std::string’ {aka ‘std::cxx11::basic_string’} to type ‘PyObject’ {aka ‘_object’} 11529 | pyx_t_2 = Pyx_PyObject_AsDouble(((PyObject *)pyx_t_1)); if (unlikely(pyx_t_2 == ((double)((double)-1)) && PyErr_Occurred())) PYX_ERR(0, 497, __pyx_L1_error) | ^~~~~ extensions/_pywrapfst.cpp:3198:50: note: in definition of macro ‘Pyx_PyObject_AsDouble’ 3198 | PyLong_AsDouble(obj) : PyxPyObject_AsDouble(obj))

My GCC version is gcc (Debian 10.2.1-6) 10.2.1 20210110, and my python version is 3.9.2, I am trying to install openfst 1.8.2 and install pynini 2.1.5

— Reply to this email directly, view it on GitHub https://github.com/kylebgorman/pynini/issues/68, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG4OJLNMBCEYYNA5DWNWLXTQIB7ANCNFSM6AAAAAA3DKXAOE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

lizaibeim commented 1 year ago

@kylebgorman Hi, my Cython version is 3.0.0.

kylebgorman commented 1 year ago

Could you test by downgrading Cython to, say, 0.29.17?

lizaibeim commented 1 year ago

Hi, after downgrading Python to 0.29.17, it still doesn't work. But very thanks to your kindly help. I just found a way to deploy my project on Raspberry Pi without using the Pynini, is it Pynini much for model training, so I just skip the requirements of this.

armaanpriyadarshan commented 10 months ago

I'm getting the same issue. I tried using Cython 0.29.17, but when I try to install with pip, it seems to get stuck on Building wheel for pynini (setup.py) ... which has been where it's at for the last 30 minutes.

kylebgorman commented 10 months ago

@armaanpriyadarshan are you seeing the errors reported by @lizaibeim? Or is it just seemingly hanging? If it’s the latter this is an unrelated issue, probably.

armaanpriyadarshan commented 10 months ago

When I used the newest version of Cython (3.0.4), it was reporting the same errors, but I downgraded Cython to 0.29.17, and that's when it started hanging. When I tried installing with setup.py, it seems to freeze at building '_pynini' extension aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.9 -c extensions/cdrewritescript.cc -o build/temp.linux-aarch64-cpython-39/extensions/cdrewritescript.o -std=c++17 -Wno-register -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-local-typedefs -funsigned-char

kylebgorman commented 10 months ago

What I think is going on is this:

armaanpriyadarshan commented 10 months ago

Alright, I will try waiting it out. Thanks for your help.

lizaibeim commented 9 months ago

Hi, you may try use the version of 0.29.28.

armaanpriyadarshan commented 9 months ago

Hi. Thanks for the reply but I no longer require Pynini for my project since I'm using AWS Polly and AWS Polly Speech Marks instead of Montreal Forced Aligner.