Installation fails on M2 MacbookAir
State: closed | Pull request: no
Labels: name: bug

I am trying to install NeMo on my Mac with the following command
```
# Install pynini-2.1.5 using Conda, required for text normalization
conda install -c conda-forge pynini

# Install Cython-0.29.36 / 3.0.0 manually
pip install cython

# Clone the NeMo-1.19.0 repo and install in development mode
git clone https://github.com/NVIDIA/NeMo
cd NeMo

./reinstall.sh
```

It fails with the error, 
```
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/li/miniconda3/include -arch arm64 -fPIC -O2 -isystem /Users/li/miniconda3/include -arch arm64 -I/opt/homebrew/opt/llvm/include -I/Users/li/miniconda3/include/python3.9 -c extensions/_pywrapfst.cpp -o build/temp.macosx-11.0-arm64-cpython-39/extensions/_pywrapfst.o -std=c++17 -Wno-register -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-local-typedefs -funsigned-char -stdlib=libc++ -mmacosx-version-min=10.7
      extensions/_pywrapfst.cpp:11531:40: error: cannot cast from type 'std::string' (aka 'basic_string<char>') to pointer type 'PyObject *' (aka '_object *')
        __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:29: note: expanded from macro '__Pyx_PyObject_AsDouble'
      ((likely(PyFloat_CheckExact(obj))) ?  PyFloat_AS_DOUBLE(obj) :\
                                  ^~~
      /Users/li/miniconda3/include/python3.9/floatobject.h:24:43: note: expanded from macro 'PyFloat_CheckExact'
      #define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type)
                                                ^~
      /Users/li/miniconda3/include/python3.9/object.h:130:63: note: expanded from macro 'Py_IS_TYPE'
      #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
                                                                    ^~
      /Users/li/miniconda3/include/python3.9/object.h:113:53: note: expanded from macro '_PyObject_CAST_CONST'
      #define _PyObject_CAST_CONST(op) ((const PyObject*)(op))
                                                          ^~
      extensions/_pywrapfst.cpp:1402:43: note: expanded from macro 'likely'
        #define likely(x)   __builtin_expect(!!(x), 1)
                                                ^
      extensions/_pywrapfst.cpp:11531:40: error: cannot cast from type 'std::string' (aka 'basic_string<char>') to pointer type 'PyObject *' (aka '_object *')
        __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:57: note: expanded from macro '__Pyx_PyObject_AsDouble'
      ((likely(PyFloat_CheckExact(obj))) ?  PyFloat_AS_DOUBLE(obj) :\
                                                              ^~~
      /Users/li/miniconda3/include/python3.9/floatobject.h:51:51: note: expanded from macro 'PyFloat_AS_DOUBLE'
      #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
                                                        ^~
      extensions/_pywrapfst.cpp:11531:40: error: cannot cast from type 'std::string' (aka 'basic_string<char>') to pointer type 'PyObject *' (aka '_object *')
        __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:3199:27: note: expanded from macro '__Pyx_PyObject_AsDouble'
       likely(PyLong_CheckExact(obj)) ?\
                                ^~~
      /Users/li/miniconda3/include/python3.9/longobject.h:16:42: note: expanded from macro 'PyLong_CheckExact'
      #define PyLong_CheckExact(op) Py_IS_TYPE(op, &PyLong_Type)
                                               ^~
      /Users/li/miniconda3/include/python3.9/object.h:130:63: note: expanded from macro 'Py_IS_TYPE'
      #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
                                                                    ^~
      /Users/li/miniconda3/include/python3.9/object.h:113:53: note: expanded from macro '_PyObject_CAST_CONST'
      #define _PyObject_CAST_CONST(op) ((const PyObject*)(op))
                                                          ^~
      extensions/_pywrapfst.cpp:1402:43: note: expanded from macro 'likely'
        #define likely(x)   __builtin_expect(!!(x), 1)
                                                ^
      extensions/_pywrapfst.cpp:11531:40: error: cannot cast from type 'std::string' (aka 'basic_string<char>') to pointer type 'PyObject *' (aka '_object *')
        __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:3200:18: note: expanded from macro '__Pyx_PyObject_AsDouble'
       PyLong_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
                       ^~~
      extensions/_pywrapfst.cpp:11531:40: error: cannot cast from type 'std::string' (aka 'basic_string<char>') to pointer type 'PyObject *' (aka '_object *')
        __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:3200:50: note: expanded from macro '__Pyx_PyObject_AsDouble'
       PyLong_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
                                                       ^~~
      5 errors generated.
      error: command '/opt/homebrew/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 pynini
  Running setup.py clean for pynini
  Building editable for nemo-toolkit (pyproject.toml) ... done
  Created wheel for nemo-toolkit: filename=nemo_toolkit-1.21.0rc0-0.editable-py3-none-any.whl size=9136 sha256=314db687677da87457eec52e2b23f442dcaac3ca226eb635123baaa16f8b33be
  Stored in directory: /private/var/folders/xn/6n4461lj6bz_dglft4zcx1hh0000gn/T/pip-ephem-wheel-cache-7c06gi35/wheels/82/6f/41/9bf9bf21f571b41675aa88a781d07e1ca16dc9e2121dc1ba3e
Successfully built nemo-toolkit
Failed to build pynini
ERROR: Could not build wheels for pynini, which is required to install pyproject.toml-based projects
```

I am confused because I could be able to install the pynini by `conda install -c conda-forge pynini`.