Skip to content

Pip install fails on macOS with Apple M1 and Python >= 3.9 #2341

Closed
@AlexIoannides

Description

@AlexIoannides

System information

  • OS Platform and Distribution: macOS 12.4 (Monterey) running on Apple M1 Max chipset.
  • Flax, jax, jaxlib versions: Flax version 0.5.3
  • Python version: >= 3.9
  • GPU/TPU model and memory: NA
  • CUDA version (if applicable): NA

Problem you have encountered:

I cannot install Flax into a virtual environment using Python 3.9 or greater. This problem is not encountered when using Python 3.8.

What you expected to happen:

Flax to be successfully installed in a virtual environment

Steps to reproduce:

$ python3.9 -m venv .venv
$ source .venv/bin/activate
$ pip install -U pip
$ pip install flax

Logs, error messages, etc:

Building wheels for collected packages: jax, tensorstore
  Building wheel for jax (setup.py) ... done
  Created wheel for jax: filename=jax-0.3.15-py3-none-any.whl size=1201920 sha256=3b2e1ffc02c289747e698e9f1ad4b6d189e291a1498d4f41f4af16c80c9ba07f
  Stored in directory: /Users/alexioannides/Library/Caches/pip/wheels/59/9d/cb/21506ed546ffa6e339e75a0bb7500d363d68349a89f9c5a080
  Building wheel for tensorstore (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for tensorstore (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [173 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating /var/folders/xk/fqw466sd3l7fztkl08x8hnk80000gn/T/tmpt8sfan0e/lib.macosx-10.9-universal2-cpython-39
      creating /var/folders/xk/fqw466sd3l7fztkl08x8hnk80000gn/T/tmpt8sfan0e/lib.macosx-10.9-universal2-cpython-39/tensorstore
      copying python/tensorstore/cc_test_driver_main.py -> /var/folders/xk/fqw466sd3l7fztkl08x8hnk80000gn/T/tmpt8sfan0e/lib.macosx-10.9-universal2-cpython-39/tensorstore
      copying python/tensorstore/__init__.py -> /var/folders/xk/fqw466sd3l7fztkl08x8hnk80000gn/T/tmpt8sfan0e/lib.macosx-10.9-universal2-cpython-39/tensorstore
      running build_ext
      /Users/alexioannides/Dropbox/work/workspace/python/data-science-and-ml-notebook/.venv/bin/python3.9 -u bazelisk.py build -c opt //python/tensorstore:_tensorstore__shared_objects --verbose_failures --macos_minimum_os=10.14
      Starting local Bazel server and connecting to it...
      Loading:
      Loading: 0 packages loaded
      Analyzing: target //python/tensorstore:_tensorstore__shared_objects (1 packages loaded, 0 targets configured)
      Analyzing: target //python/tensorstore:_tensorstore__shared_objects (34 packages loaded, 133 targets configured)
      Analyzing: target //python/tensorstore:_tensorstore__shared_objects (34 packages loaded, 133 targets configured)
      Analyzing: target //python/tensorstore:_tensorstore__shared_objects (34 packages loaded, 133 targets configured)
      Analyzing: target //python/tensorstore:_tensorstore__shared_objects (107 packages loaded, 1623 targets configured)
      Analyzing: target //python/tensorstore:_tensorstore__shared_objects (122 packages loaded, 2872 targets configured)
      INFO: Analyzed target //python/tensorstore:_tensorstore__shared_objects (125 packages loaded, 5487 targets configured).
      INFO: Found 1 target...
      [0 / 385] [Prepa] Writing script python/tensorstore/_tensorstore_cc.cppmap ... (3 actions, 0 running)
      [327 / 803] Compiling jchuff.c; 1s darwin-sandbox ... (10 actions, 9 running)
      [550 / 859] Compiling tensorstore/driver/copy.cc; 1s darwin-sandbox ... (10 actions, 9 running)
      [606 / 902] Compiling tensorstore/driver/virtual_chunked/virtual_chunked.cc; 2s darwin-sandbox ... (10 actions, 9 running)
      [646 / 946] Compiling python/tensorstore/virtual_chunked.cc; 2s darwin-sandbox ... (10 actions, 9 running)
      [751 / 1,035] Compiling python/tensorstore/virtual_chunked.cc; 4s darwin-sandbox ... (10 actions, 9 running)
      [820 / 1,093] Compiling tensorstore/context.cc; 2s darwin-sandbox ... (10 actions, 9 running)
      [928 / 1,188] Compiling python/tensorstore/status.cc; 2s darwin-sandbox ... (9 actions, 8 running)
      [1,086 / 1,452] Compiling tensorstore/driver/kvs_backed_chunk_driver.cc; 3s darwin-sandbox ... (10 actions, 9 running)
      INFO: From Compiling lib/vtls/sectransp.c:
      external/se_curl/lib/vtls/sectransp.c:1004:6: warning: address of function 'SecCertificateCopyLongDescription' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SecCertificateCopyLongDescription)
        ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:1004:6: note: prefix with the address-of operator to silence this warning
        if(SecCertificateCopyLongDescription)
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:1011:6: warning: address of function 'SecCertificateCopySubjectSummary' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SecCertificateCopySubjectSummary)
        ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:1011:6: note: prefix with the address-of operator to silence this warning
        if(SecCertificateCopySubjectSummary)
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:1125:6: warning: address of function 'SecItemCopyMatching' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SecItemCopyMatching && kSecClassIdentity) {
           ^~~~~~~~~~~~~~~~~~~ ~~
      external/se_curl/lib/vtls/sectransp.c:1125:6: note: prefix with the address-of operator to silence this warning
        if(SecItemCopyMatching && kSecClassIdentity) {
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:1415:6: warning: address of function 'SSLSetProtocolVersionMax' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SSLSetProtocolVersionMax) {
        ~~ ^~~~~~~~~~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:1415:6: note: prefix with the address-of operator to silence this warning
        if(SSLSetProtocolVersionMax) {
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:1699:6: warning: address of function 'SSLCreateContext' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SSLCreateContext) {  /* use the newer API if available */
        ~~ ^~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:1699:6: note: prefix with the address-of operator to silence this warning
        if(SSLCreateContext) {  /* use the newer API if available */
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:1733:6: warning: address of function 'SSLSetProtocolVersionMax' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SSLSetProtocolVersionMax) {
        ~~ ^~~~~~~~~~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:1733:6: note: prefix with the address-of operator to silence this warning
        if(SSLSetProtocolVersionMax) {
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:1991:6: warning: address of function 'SSLSetSessionOption' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SSLSetSessionOption && darwinver_maj >= 13) {
           ^~~~~~~~~~~~~~~~~~~ ~~
      external/se_curl/lib/vtls/sectransp.c:1991:6: note: prefix with the address-of operator to silence this warning
        if(SSLSetSessionOption && darwinver_maj >= 13) {
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:2082:6: warning: address of function 'SSLSetSessionOption' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SSLSetSessionOption) {
        ~~ ^~~~~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:2082:6: note: prefix with the address-of operator to silence this warning
        if(SSLSetSessionOption) {
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:2967:6: warning: address of function 'SecTrustEvaluateAsync' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SecTrustEvaluateAsync) {
        ~~ ^~~~~~~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:2967:6: note: prefix with the address-of operator to silence this warning
        if(SecTrustEvaluateAsync) {
           ^
           &
      external/se_curl/lib/vtls/sectransp.c:3187:8: warning: address of function 'SSLCreateContext' will always evaluate to 'true' [-Wpointer-bool-conversion]
          if(SSLCreateContext)
          ~~ ^~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:3187:8: note: prefix with the address-of operator to silence this warning
          if(SSLCreateContext)
             ^
             &
      external/se_curl/lib/vtls/sectransp.c:3357:6: warning: address of function 'SSLSetSessionOption' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if(SSLSetSessionOption)
        ~~ ^~~~~~~~~~~~~~~~~~~
      external/se_curl/lib/vtls/sectransp.c:3357:6: note: prefix with the address-of operator to silence this warning
        if(SSLSetSessionOption)
           ^
           &
      11 warnings generated.
      [1,252 / 1,485] Compiling lib/curl_rtmp.c; 0s darwin-sandbox ... (10 actions, 9 running)
      INFO: From Compiling blosc/blosc.c:
      external/org_blosc_cblosc/blosc/blosc.c:735:11: warning: variable 'ctbytes' set but not used [-Wunused-but-set-variable]
        int32_t ctbytes = 0;           /* number of compressed bytes in block */
                ^
      1 warning generated.
      INFO: From Compiling blosc/fastcopy.c:
      external/org_blosc_cblosc/blosc/fastcopy.c:63:30: warning: unused function 'copy_5_bytes' [-Wunused-function]
      static inline unsigned char *copy_5_bytes(unsigned char *out, const unsigned char *from) {
                                   ^
      external/org_blosc_cblosc/blosc/fastcopy.c:68:30: warning: unused function 'copy_6_bytes' [-Wunused-function]
      static inline unsigned char *copy_6_bytes(unsigned char *out, const unsigned char *from) {
                                   ^
      external/org_blosc_cblosc/blosc/fastcopy.c:73:30: warning: unused function 'copy_7_bytes' [-Wunused-function]
      static inline unsigned char *copy_7_bytes(unsigned char *out, const unsigned char *from) {
                                   ^
      3 warnings generated.
      [1,380 / 1,719] Compiling tensorstore/driver/neuroglancer_precomputed/driver.cc; 3s darwin-sandbox ... (10 actions, 9 running)
      [1,495 / 1,719] Compiling av1/decoder/decodeframe.c; 0s darwin-sandbox ... (10 actions running)
      [1,719 / 1,901] Compiling python/tensorstore/kvstore.cc; 4s darwin-sandbox ... (10 actions running)
      ERROR: /private/var/tmp/_bazel_alexioannides/746f47a53dbc822deda7b954035221c4/external/org_aomedia_aom/BUILD.bazel:580:11: Compiling aom_dsp/arm/subpel_variance_neon.c failed: (Exit 1): cc_wrapper.sh failed: error executing command
        (cd /private/var/tmp/_bazel_alexioannides/746f47a53dbc822deda7b954035221c4/sandbox/darwin-sandbox/890/execroot/com_google_tensorstore && \
        exec env - \
          PATH=/bin:/usr/bin:/usr/local/bin \
          PWD=/proc/self/cwd \
        external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections -MD -MF bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom/_objs/dsp/subpel_variance_neon.pic.d '-frandom-seed=bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom/_objs/dsp/subpel_variance_neon.pic.o' -fPIC -iquote external/org_aomedia_aom -iquote bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom '-fdiagnostics-color=always' -Wno-deprecated-declarations -Wno-sign-compare '-std=c99' -DNEON_INTRINSICS -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c -o bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom/_objs/dsp/subpel_variance_neon.pic.o)
      # Configuration: 84799bc94b0aa478ce98deadb38451bae5772174dc99beda441f5876af874716
      # Execution platform: @local_config_platform//:host
      
      Use --sandbox_debug to see verbose messages from the sandbox
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:121:10: error: implicit declaration of function 'aom_variance8x8_neon' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return aom_variance8x8_neon(temp2, 8, dst, dst_stride, sse);
               ^
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:121:10: note: did you mean 'aom_variance8x8_c'?
      bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom/config/aom_dsp_rtcd.h:4729:14: note: 'aom_variance8x8_c' declared here
      unsigned int aom_variance8x8_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
                   ^
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:136:10: error: implicit declaration of function 'aom_variance16x16_neon' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return aom_variance16x16_neon(temp2, 16, dst, dst_stride, sse);
               ^
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:136:10: note: did you mean 'aom_variance16x16_c'?
      bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom/config/aom_dsp_rtcd.h:4663:14: note: 'aom_variance16x16_c' declared here
      unsigned int aom_variance16x16_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
                   ^
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:151:10: error: implicit declaration of function 'aom_variance32x32_neon' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return aom_variance32x32_neon(temp2, 32, dst, dst_stride, sse);
               ^
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:151:10: note: did you mean 'aom_variance32x32_c'?
      bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom/config/aom_dsp_rtcd.h:4687:14: note: 'aom_variance32x32_c' declared here
      unsigned int aom_variance32x32_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
                   ^
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:166:10: error: implicit declaration of function 'aom_variance64x64_neon' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return aom_variance64x64_neon(temp2, 64, dst, dst_stride, sse);
               ^
      external/org_aomedia_aom/aom_dsp/arm/subpel_variance_neon.c:166:10: note: did you mean 'aom_variance64x64_c'?
      bazel-out/darwin_arm64-opt/bin/external/org_aomedia_aom/config/aom_dsp_rtcd.h:4717:14: note: 'aom_variance64x64_c' declared here
      unsigned int aom_variance64x64_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
                   ^
      4 errors generated.
      Target //python/tensorstore:_tensorstore__shared_objects failed to build
      INFO: Elapsed time: 51.604s, Critical Path: 8.05s
      INFO: 1751 processes: 869 internal, 882 darwin-sandbox.
      FAILED: Build did NOT complete successfully
      FAILED: Build did NOT complete successfully
      error: command '/Users/alexioannides/Dropbox/work/workspace/python/data-science-and-ml-notebook/.venv/bin/python3.9' 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 tensorstore
Successfully built jax
Failed to build tensorstore
ERROR: Could not build wheels for tensorstore, which is required to install pyproject.toml-based projects

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions