MacOS(Apple M1 chip) fail to install azure SDK

Zhang, Ben 1 Reputation point
2022-11-30T00:14:19.77+00:00

On Apple M1-Chip MacOS, I am trying to pip-install azure sdk but got architecture NOT supported error.

my requirements.txt:
azure-identity>=1.12.0
azure-mgmt-storage>=21.0.0
azure-mgmt-recoveryservices>=2.1.0
azure-mgmt-recoveryservicesbackup>=5.0.0
azure-storage-queue>=12.5.0
azure-data-tables>=12.4.1
azure-core>=1.26.1
azure-mgmt-compute>=29.0.0
azure-core>=1.26.1

Run pip install -r requirements.txt, get following errors (some logs omitted):

Collecting oauthlib>=3.0.0  
  Using cached oauthlib-3.2.2-py3-none-any.whl (151 kB)  
Building wheels for collected packages: yarl, multidict  
  Building wheel for yarl (pyproject.toml) ... error  
  error: subprocess-exited-with-error  
  
  × Building wheel for yarl (pyproject.toml) did not run successfully.  
  │ exit code: 1  
  ╰─> [135 lines of output]  
      /private/var/folders/q6/ph40b7_n699dttg0drhvxt0h0000gp/T/pip-build-env-cfxdja98/overlay/lib/python3.11/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.  
        warnings.warn(msg, warning_class)  
      **********************  
      * Accelerated build *  
      **********************  
      running bdist_wheel  
      running build  
      running build_py  
      creating build  
      creating build/lib.macosx-10.9-universal2-cpython-311  
      creating build/lib.macosx-10.9-universal2-cpython-311/yarl  
      copying yarl/_url.py -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      copying yarl/_quoting_py.py -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      copying yarl/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      copying yarl/_quoting.py -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      running egg_info  
      writing yarl.egg-info/PKG-INFO  
      writing dependency_links to yarl.egg-info/dependency_links.txt  
      writing requirements to yarl.egg-info/requires.txt  
      writing top-level names to yarl.egg-info/top_level.txt  
      reading manifest file 'yarl.egg-info/SOURCES.txt'  
      reading manifest template 'MANIFEST.in'  
      warning: no previously-included files matching '*.pyc' found anywhere in distribution  
      warning: no previously-included files matching '*.cache' found anywhere in distribution  
      warning: no previously-included files found matching 'yarl/*.html'  
      warning: no previously-included files found matching 'yarl/*.so'  
      warning: no previously-included files found matching 'yarl/*.pyd'  
      no previously-included directories found matching 'docs/_build'  
      adding license file 'LICENSE'  
      writing manifest file 'yarl.egg-info/SOURCES.txt'  
      copying yarl/__init__.pyi -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      copying yarl/_quoting_c.pyi -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      copying yarl/_quoting_c.pyx -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      copying yarl/py.typed -> build/lib.macosx-10.9-universal2-cpython-311/yarl  
      running build_ext  
      building 'yarl._quoting_c' extension  
      creating build/temp.macosx-10.9-universal2-cpython-311  
      creating build/temp.macosx-10.9-universal2-cpython-311/yarl  
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c yarl/_quoting_c.c -o build/temp.macosx-10.9-universal2-cpython-311/yarl/_quoting_c.o  
      In file included from yarl/_quoting_c.c:6:  
      In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:  
      In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:62:  
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture  
      #error Unsupported architecture  

.....
typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */
^
note: '__uint128_t' declared here
In file included from yarl/_quoting_c.c:6:
In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:64:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_wctype_t;
^
note: '__uint128_t' declared here
In file included from yarl/_quoting_c.c:6:
In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/wait.h:109:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:82:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/signal.h:34:2: error: architecture not supported
#error architecture not supported
^
In file included from yarl/_quoting_c.c:6:
In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/wait.h:109:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:146:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_mcontext.h:31:2: error: architecture not supported
#error architecture not supported
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
.....

In file included from multidict/_multidict.c:1:
In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/wait.h:109:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:82:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/signal.h:34:2: error: architecture not supported
#error architecture not supported
^
In file included from multidict/_multidict.c:1:
In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/wait.h:109:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:146:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_mcontext.h:31:2: error: architecture not supported
#error architecture not supported
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
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 multidict
Failed to build yarl multidict
ERROR: Could not build wheels for yarl, multidict, which is required to install pyproject.toml-based projects

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,962 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Zhang, Ben 1 Reputation point
    2022-12-04T18:00:27.963+00:00

    It looks that after installing xcode on the Macbook, the issue is solved.

    0 comments No comments

  2. Zhang, Ben 1 Reputation point
    2022-12-07T16:43:52.537+00:00

    Seems still having this issue:

    >> from azure.identity import ManagedIdentityCredential, ClientSecretCredential

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/azure/identity/init.py", line 10, in <module>
    from ._credentials import (
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/azure/identity/_credentials/init.py", line 5, in <module>
    from .authorization_code import AuthorizationCodeCredential
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/azure/identity/_credentials/authorization_code.py", line 9, in <module>
    from .._internal.aad_client import AadClient
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/azure/identity/_internal/init.py", line 5, in <module>
    from .aad_client import AadClient
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/azure/identity/_internal/aad_client.py", line 11, in <module>
    from .aad_client_base import AadClientBase
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/azure/identity/_internal/aad_client_base.py", line 20, in <module>
    from .aadclient_certificate import AadClientCertificate
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/azure/identity/_internal/aadclient_certificate.py", line 7, in <module>
    from cryptography import x509
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cryptography/x509/init.py", line 6, in <module>
    from cryptography.x509 import certificate_transparency
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cryptography/x509/certificate_transparency.py", line 10, in <module>
    from cryptography.hazmat.bindings._rust import x509 as rust_x509
    ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

    0 comments No comments

  3. Zhang, Ben 1 Reputation point
    2022-12-09T00:24:20.497+00:00

    The solution after more research is to enable Rosetta on iTerm/2/3 to install python and sdk

    0 comments No comments