Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install bfloat16 failed on MacOS #7

Open
sfc-gh-zhwang opened this issue Aug 25, 2023 · 2 comments
Open

pip install bfloat16 failed on MacOS #7

sfc-gh-zhwang opened this issue Aug 25, 2023 · 2 comments

Comments

@sfc-gh-zhwang
Copy link

Collecting bfloat16
  Using cached bfloat16-1.1.tar.gz (550 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: bfloat16
  Building wheel for bfloat16 (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [152 lines of output]
      /opt/homebrew/lib/python3.11/site-packages/setuptools/dist.py:788: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      bfloat16.cc:43:20: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                      using bfloat16 = Eigen::bfloat16;
                                       ^
      bfloat16.cc:44:17: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                      using uint8 = std::uint8_t;
                                    ^
      bfloat16.cc:45:16: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                      using int8 = std::int8_t;
                                   ^
      bfloat16.cc:46:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                      using uint16 = std::uint16_t;
                                     ^
      bfloat16.cc:47:17: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                      using int16 = std::int16_t;
                                    ^
      bfloat16.cc:48:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                      using uint64 = std::uint64_t;
                                     ^
      bfloat16.cc:57:28: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                      using Safe_PyObjectPtr = std::unique_ptr<PyObject, PyDecrefDeleter>;
                                               ^
      bfloat16.cc:462:26: error: unexpected type name 'bfloat16': expected expression
                              /*alignment=*/alignof(bfloat16),
                                                    ^
      bfloat16.cc:757:43: error: a space is required between consecutive right angle brackets (use '> >')
                      struct TypeDescriptor<std::complex<float>>
                                                              ^~
                                                              > >
      bfloat16.cc:764:44: error: a space is required between consecutive right angle brackets (use '> >')
                      struct TypeDescriptor<std::complex<double>>
                                                               ^~
                                                               > >
      bfloat16.cc:782:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                              const auto *from =
                                    ^
      bfloat16.cc:784:4: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                              auto *to = reinterpret_cast<typename TypeDescriptor<To>::T *>(to_void);
                              ^
      bfloat16.cc:818:12: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                      return {TypeDescriptor<InType>::Dtype(), TypeDescriptor<OutType>::Dtype()};
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:827:6: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                                              auto x = *reinterpret_cast<const typename TypeDescriptor<InType>::T *>(i0);
                                              ^
      bfloat16.cc:841:12: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                      return {TypeDescriptor<InType>::Dtype(), TypeDescriptor<OutType>::Dtype(),
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:852:6: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                                              auto x = *reinterpret_cast<const typename TypeDescriptor<InType>::T *>(i0);
                                              ^
      bfloat16.cc:853:11: error: no member named 'tie' in namespace 'std'; did you mean 'time'?
                                              std::tie(*reinterpret_cast<typename TypeDescriptor<OutType>::T *>(o0),
                                              ~~~~~^~~
                                                   time
      /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/c++/v1/ctime:70:9: note: 'time' declared here
      using ::time _LIBCPP_USING_IF_EXISTS;
              ^
      bfloat16.cc:868:12: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                      return {TypeDescriptor<InType>::Dtype(), TypeDescriptor<InType>::Dtype(),
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:884:6: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                                              auto x = *reinterpret_cast<const typename TypeDescriptor<InType>::T *>(i0);
                                              ^
      bfloat16.cc:885:6: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                                              auto y = *reinterpret_cast<const typename TypeDescriptor<InType>::T *>(i1);
                                              ^
      bfloat16.cc:912:12: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                      return {TypeDescriptor<InType>::Dtype(), TypeDescriptor<InType2>::Dtype(),
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:928:6: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                                              auto x = *reinterpret_cast<const typename TypeDescriptor<InType>::T *>(i0);
                                              ^
      bfloat16.cc:929:6: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                                              auto y =
                                              ^
      bfloat16.cc:1040:13: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                              return {nan, nan};
                                                     ^~~~~~~~~~
      bfloat16.cc:1040:13: error: non-aggregate type 'std::pair<float, float>' cannot be initialized with an initializer list
                                              return {nan, nan};
                                                     ^~~~~~~~~~
      bfloat16.cc:1070:12: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                      return {floordiv, mod};
                                             ^~~~~~~~~~~~~~~
      bfloat16.cc:1070:12: error: non-aggregate type 'std::pair<float, float>' cannot be initialized with an initializer list
                                      return {floordiv, mod};
                                             ^~~~~~~~~~~~~~~
      bfloat16.cc:1092:13: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                              return {npy_bfloat16, npy_bfloat16, npy_bfloat16, npy_bfloat16};
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:1092:13: error: non-aggregate type 'std::vector<int>' cannot be initialized with an initializer list
                                              return {npy_bfloat16, npy_bfloat16, npy_bfloat16, npy_bfloat16};
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:1106:12: error: no member named 'tie' in namespace 'std'
                                                      std::tie(floordiv, mod) =
                                                      ~~~~~^
      bfloat16.cc:1202:13: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                              return {bfloat16(f), exp};
                                                     ^~~~~~~~~~~~~~~~~~
      bfloat16.cc:1202:13: error: non-aggregate type 'std::pair<bfloat16, int>' (aka 'pair<Eigen::bfloat16, int>') cannot be initialized with an initializer list
                                              return {bfloat16(f), exp};
                                                     ^~~~~~~~~~~~~~~~~~
      bfloat16.cc:1331:13: warning: generalized initializer lists are a C++11 extension [-Wc++11-extensions]
                                              return {bfloat16(f), bfloat16(integral)};
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:1331:13: error: non-aggregate type 'std::pair<bfloat16, bfloat16>' (aka 'pair<Eigen::bfloat16, Eigen::bfloat16>') cannot be initialized with an initializer list
                                              return {bfloat16(f), bfloat16(integral)};
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bfloat16.cc:1495:13: error: unknown type name 'constexpr'
                                              static constexpr float radians_per_degree = M_PI / 180.0f;
                                                     ^
      bfloat16.cc:1503:13: error: unknown type name 'constexpr'
                                              static constexpr float degrees_per_radian = 180.0f / M_PI;
                                                     ^
      bfloat16.cc:1688:3: warning: implicit conversion of NULL constant to 'bool' [-Wnull-conversion]
                      import_array();
                      ^~~~~~~~~~~~~~
      /opt/homebrew/lib/python3.11/site-packages/numpy/core/include/numpy/__multiarray_api.h:1559:151: note: expanded from macro 'import_array'
      #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
                                                                                                                                                     ~~~~~~ ^
      bfloat16.cc:1747:31: error: expression is not assignable
                      Py_TYPE(&NPyBfloat16_Descr) = &PyArrayDescr_Type;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      bfloat16.cc:1830:47: error: a space is required between consecutive right angle brackets (use '> >')
                      if (!RegisterBfloat16Cast<std::complex<float>>(NPY_COMPLEX64,
                                                                  ^~
                                                                  > >
      bfloat16.cc:1835:48: error: a space is required between consecutive right angle brackets (use '> >')
                      if (!RegisterBfloat16Cast<std::complex<double>>(NPY_COMPLEX128, /*cast_is_safe=*/true))
                                                                   ^~
                                                                   > >
      bfloat16.cc:1841:61: error: a space is required between consecutive right angle brackets (use '> >')
                              RegisterUFunc<BinaryUFunc<bfloat16, bfloat16, ufuncs::Add>>(numpy.get(), "add") &&
                                                                                       ^~
                                                                                       > >
      bfloat16.cc:1842:80: error: a space is required between consecutive right angle brackets (use '> >')
                              RegisterUFunc<BinaryUFunc2<float, bfloat16, bfloat16, ufuncs::ScalarFloatAdd>>(numpy.get(), "add") &&
                                                                                                          ^~
                                                                                                          > >
      bfloat16.cc:1843:80: error: a space is required between consecutive right angle brackets (use '> >')
                              RegisterUFunc<BinaryUFunc2<bfloat16, float, bfloat16, ufuncs::AddScalarFloat>>(numpy.get(), "add") &&
                                                                                                          ^~
                                                                                                          > >
      bfloat16.cc:1844:66: error: a space is required between consecutive right angle brackets (use '> >')
                              RegisterUFunc<BinaryUFunc<bfloat16, bfloat16, ufuncs::Subtract>>(numpy.get(), "subtract") &&
                                                                                            ^~
                                                                                            > >
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      25 warnings and 20 errors generated.
      error: command '/usr/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 bfloat16
  Running setup.py clean for bfloat16
Failed to build bfloat16
ERROR: Could not build wheels for bfloat16, which is required to install pyproject.toml-based projects
@aboluock
Copy link

Have you fixed it? I had the same problem.

@beileiyuyue
Copy link

+1

xhmelon added a commit to xhmelon/bfloat16 that referenced this issue Sep 19, 2023
bfloat16 could not be built since Python 3.11, for Py_TYPE has been
deprecated since Python 3.9, see PEP 674 and Common Object
Structures docs for details. This issue was covered in GreenWaves-Technologies#5.
bfloat16 could not be built on macOS, because C++11 flag is not
enabled by default in clang. This issue was covered in GreenWaves-Technologies#7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants