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

typed-ast install failed on Apple Silicon and python version 3.10.2 #7

Open
ethanleifer opened this issue Mar 12, 2022 · 1 comment

Comments

@ethanleifer
Copy link
Collaborator

  • secret_sdk version:
  • Python version: 3.10.2
  • Operating System: macOS Monterey 12.0 running on Apple Silicon

Description

When running $ poetry install, the installation of https://github.com/python/typed_ast failed when compiling for Apple Silicon. It seems like they fixed it for Intel-based chips through python/typed_ast#156 but never fixed it for Apple Silicon processors. This is the commit that finished the pr: python/typed_ast@adfe297 and the comment says that it doesn't fix it for Apple Silicon.

The same problem exists for python 3.9: python/typed_ast#146 and python 3.8: python/typed_ast#126.

It seems like they are adding support for what they can, but the typed_ast readme says:

typed_ast will not be updated to support parsing Python 3.8 and newer. Instead, it is recommended to use the stdlib ast module there, which has been augmented to support extracting type comments and has limited support for parsing older versions of Python 3.

@benlachman
Copy link

benlachman commented Mar 17, 2022

Same experience here. poetry install output:

Error Output

  • Installing typed-ast (1.4.3): Failed

  EnvCommandError

  Command ['/Users/ben/Library/Caches/pypoetry/virtualenvs/event-monitor-gO16D4hE-py3.9/bin/pip', 'install', '--no-deps', '/Users/ben/Library/Caches/pypoetry/artifacts/f1/c8/25/f53823ebf321e1c1d8b93b26f4d88bc905010a643dda9d85f5cfd4af37/typed_ast-1.4.3.tar.gz'] errored with the following return code 1, and output: 
  Processing /Users/ben/Library/Caches/pypoetry/artifacts/f1/c8/25/f53823ebf321e1c1d8b93b26f4d88bc905010a643dda9d85f5cfd4af37/typed_ast-1.4.3.tar.gz
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'done'
  Building wheels for collected packages: typed-ast
    Building wheel for typed-ast (setup.py): started
    Building wheel for typed-ast (setup.py): finished with status 'error'
    error: subprocess-exited-with-error
    
    × python setup.py bdist_wheel did not run successfully.
    │ exit code: 1
    ╰─> [22 lines of output]
        running bdist_wheel
        running build
        running build_py
        package init file 'ast3/tests/__init__.py' not found (or not a regular file)
        running build_ext
        building '_ast27' extension
        building '_ast3' extension
        ast3/Python/ast.c:844:5: warning: code will never be executed [-Wunreachable-code]
            abort();
            ^~~~~
        ast3/Python/ast.c:4514:9: error: implicit declaration of function '_PyUnicode_DecodeUnicodeEscape' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
                ^
        ast3/Python/ast.c:4514:9: note: did you mean 'PyUnicode_DecodeUnicodeEscape'?
        /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/unicodeobject.h:588:23: note: 'PyUnicode_DecodeUnicodeEscape' declared here
        PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
                              ^
        ast3/Python/ast.c:4514:7: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
            v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        2 warnings and 1 error 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 typed-ast
    Running setup.py clean for typed-ast
  Failed to build typed-ast
  Installing collected packages: typed-ast
    Running setup.py install for typed-ast: started
    Running setup.py install for typed-ast: finished with status 'error'
    error: subprocess-exited-with-error
    
    × Running setup.py install for typed-ast did not run successfully.
    │ exit code: 1
    ╰─> [24 lines of output]
        running install
        /Users/ben/Library/Caches/pypoetry/virtualenvs/event-monitor-gO16D4hE-py3.9/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
          warnings.warn(
        running build
        running build_py
        package init file 'ast3/tests/__init__.py' not found (or not a regular file)
        running build_ext
        building '_ast27' extension
        building '_ast3' extension
        ast3/Python/ast.c:844:5: warning: code will never be executed [-Wunreachable-code]
            abort();
            ^~~~~
        ast3/Python/ast.c:4514:9: error: implicit declaration of function '_PyUnicode_DecodeUnicodeEscape' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
                ^
        ast3/Python/ast.c:4514:9: note: did you mean 'PyUnicode_DecodeUnicodeEscape'?
        /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/unicodeobject.h:588:23: note: 'PyUnicode_DecodeUnicodeEscape' declared here
        PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
                              ^
        ast3/Python/ast.c:4514:7: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
            v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        2 warnings and 1 error 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: legacy-install-failure
  
  × Encountered error while trying to install package.
  ╰─> typed-ast
  
  note: This is an issue with the package mentioned above, not pip.
  hint: See above for output from the failure.
  WARNING: You are using pip version 22.0.3; however, version 22.0.4 is available.
  You should consider upgrading via the '/Users/ben/Library/Caches/pypoetry/virtualenvs/event-monitor-gO16D4hE-py3.9/bin/python -m pip install --upgrade pip' command.
  

  at ~/.poetry/lib/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│ 
      1197│         return decode(output)
      1198│ 
      1199│     def execute(self, bin, *args, **kwargs):

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

2 participants