pyjson5 icon indicating copy to clipboard operation
pyjson5 copied to clipboard

Installation issue on MacOS - ARM chip

Open Sebadst opened this issue 1 year ago • 1 comments

Hi,

I am unable to install this lib. I am reporting here what I am using and the errors I am getting. I am wondering whether I am missing something or if it's indeed expected not to be able to install it on these versions.

Python: 3.10.13 Mac OS: 14.2.1, Chip Apple M1 Pro Poetry: 1.6.1 Issue returned (partially omitted since the output was too long):

Installing dependencies from lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing pyjson5 (1.6.5): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-13.5-arm64-cpython-310
  creating build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  copying src/pyjson5/__init__.py -> build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  running egg_info
  writing src/pyjson5.egg-info/PKG-INFO
  writing dependency_links to src/pyjson5.egg-info/dependency_links.txt
  writing top-level names to src/pyjson5.egg-info/top_level.txt
  reading manifest file 'src/pyjson5.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching 'requires.txt'
  adding license file 'LICENSE'
  writing manifest file 'src/pyjson5.egg-info/SOURCES.txt'
  copying src/pyjson5/__init__.pyi -> build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  copying src/pyjson5/py.typed -> build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  running build_ext
  Compiling pyjson5.pyx because it changed.
  [1/1] Cythonizing pyjson5.pyx
  building 'pyjson5.pyjson5' extension
  creating build/temp.macosx-13.5-arm64-cpython-310
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Isrc -I/var/folders/s9/nvj_sch51rn89b44pgzk5fpr0000gp/T/tmp2242py13/.venv/include -I/Users/seba/.pyenv/versions/3.10.13/include/python3.10 -c pyjson5.cpp -o build/temp.macosx-13.5-arm64-cpython-310/pyjson5.o -std=c++11 -O3 -fPIC -ggdb1 -pipe -fomit-frame-pointer -fstack-protector-strong
  In file included from pyjson5.cpp:58:
  In file included from /Users/seba/.pyenv/versions/3.10.13/include/python3.10/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
          unsigned char   *_base;
                          ^
   .....
  
                                                 ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:643:17: note: declared here
  template <class _A1, class _A2>
                  ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:646:58: error: expected unqualified-id
                                  std::__promote<_A1, _A2> >::type
                                                           ^
  In file included from pyjson5.cpp:1266:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:833:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:456:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_compound.h:14:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_fundamental.h:14:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
  template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                  ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: template argument for template type parameter must be a type
  template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                  ^~~~~~~~~
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:23:17: note: template parameter is declared here
  template <class _Tp> struct __is_nullptr_t_impl       : public false_type {};
                  ^
  In file included from pyjson5.cpp:1267:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/utility:277:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib:90:5: error: <cstdlib> tried including <stdlib.h> but didn't find libc++'s <stdlib.h> header.           This usually means that your header search paths are not configured properly.           The header search paths should contain the C++ Standard Library headers before           any C Standard Library, and you are probably using compiler flags that make that           not be the case.
  #   error <cstdlib> tried including <stdlib.h> but didn't find libc++'s <stdlib.h> header. \
      ^
  In file included from pyjson5.cpp:1268:
  In file included from ./src/native.hpp:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/array:122:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdexcept:47:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:199:45: error: field has incomplete type 'exception_ptr'
      _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                              ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:194:24: note: definition of 'std::exception_ptr' is not complete until the closing '}'
  class _LIBCPP_TYPE_VIS exception_ptr
                         ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:199:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
      _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
      ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:709:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
  #  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                      ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:688:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
            __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
                           ^
  In file included from pyjson5.cpp:1268:
  In file included from ./src/native.hpp:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/array:122:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdexcept:47:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:199:55: error: expected ';' at end of declaration list
      _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                                        ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  193 warnings and 20 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  

  at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/chef.py:147 in _prepare
      143│ 
      144│                 error = ChefBuildError("\n\n".join(message_parts))
      145│ 
      146│             if error is not None:
    → 147│                 raise error from None
      148│ 
      149│             return path
      150│ 
      151│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pyjson5 (1.6.5) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "pyjson5 (==1.6.5)"'.

Sebadst avatar Jan 07 '24 14:01 Sebadst

Thank you for providing the installation log! I did not provide the pre-compiled version for your system, and the compilation fails for some reason.

I just uploaded pre-compiled versions for MacOS arm64+universal2, and for Windows ARM64. Can you please tell me if that fixes the problem for you?

Kijewski avatar Jan 07 '24 18:01 Kijewski

sorry, stupid question surely, but how can I check that? 🙏

so far I was just trying to install the lib through a poetry install

Sebadst avatar Jan 24 '24 20:01 Sebadst

sorry, stupid question surely, but how can I check that? 🙏

so far I was just trying to install the lib through a poetry install

I never used poetry, so I am not quite sure. Does poetry use the precompiled wheels from pypi.org? If so, then the bug should be fixed for you. If not, then probably not. :) Could you please try to install the package again?

Kijewski avatar Jan 24 '24 21:01 Kijewski

so, when running poetry install I got the exact same error as before. However, if I now run pip wheel --no-cache-dir --use-pep517 "pyjson5 (==1.6.5)" (as suggested at the end of the command posted at the beginning), it looks like I am now able to install pyjson5-1.6.5-cp310-cp310-macosx_11_0_arm64.whl (while I wasn't before).

It looks like I can use the precompiled wheel this way, which is something I can't commit in my repo, but at least it solves my problem of not being able to run the project locally, so good enough 😄 thanks a lot!

Sebadst avatar Jan 24 '24 21:01 Sebadst