Skip to content

conda cannot run an aarch64 .so on an aarch64 machine #982

@rseymour

Description

@rseymour

Bug Description

I don't know what the bug is. The wheel created in pyO3 and CFFI mode both seems to be incompatible with my platform. I've tested with both, but here's the output:

[9:10:50] mat ❯ maturin new whatever
✔ 🤷 Which kind of bindings to use? · pyo3
  ✨ Done! New project created whatever

~/src
[9:10:54] mat ❯ cd whatever

~/src/whatever
[9:10:57] mat ❯ ls
Cargo.toml     pyproject.toml src

~/src/whatever
[9:10:58] mat ❯ maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.10 at /opt/homebrew/anaconda3/envs/mat/bin/python
   Compiling target-lexicon v0.12.4
   Compiling proc-macro2 v1.0.40
   Compiling once_cell v1.12.0
   Compiling unicode-ident v1.0.1
   Compiling quote v1.0.20
   Compiling libc v0.2.126
   Compiling autocfg v1.1.0
   Compiling syn v1.0.98
   Compiling parking_lot_core v0.9.3
   Compiling scopeguard v1.1.0
   Compiling cfg-if v1.0.0
   Compiling smallvec v1.8.0
   Compiling indoc v1.0.6
   Compiling unindent v0.1.9
   Compiling lock_api v0.4.7
   Compiling pyo3-build-config v0.16.5
   Compiling parking_lot v0.12.1
   Compiling pyo3-ffi v0.16.5
   Compiling pyo3 v0.16.5
   Compiling pyo3-macros-backend v0.16.5
   Compiling pyo3-macros v0.16.5
   Compiling whatever v0.1.0 (/Users/rseymour/src/whatever)
    Finished dev [unoptimized + debuginfo] target(s) in 6.55s
📦 Built wheel for CPython 3.10 to /var/folders/2c/z3xyp3hj53z0qbwqlt75tn_c0000gn/T/.tmpYipyUF/whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
💥 maturin failed
  Caused by: pip install in /opt/homebrew/anaconda3/envs/mat failed running ["-m", "pip", "--disable-pip-version-check", "install", "--force-reinstall"]: exit status: 1
--- Stdout:

--- Stderr:
ERROR: whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl is not a supported wheel on this platform.
---

unzipping the wheel and running file on the .so:

[9:11:12] mat ❯ maturin build
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at /opt/homebrew/anaconda3/bin/python3.9, CPython 3.10 at /opt/homebrew/anaconda3/envs/mat/bin/python3.10
📦 Built source distribution to /Users/rseymour/src/whatever/target/wheels/whatever-0.1.0.tar.gz
   Compiling pyo3-build-config v0.16.5
   Compiling pyo3-ffi v0.16.5
   Compiling pyo3 v0.16.5
   Compiling whatever v0.1.0 (/Users/rseymour/src/whatever)
    Finished dev [unoptimized + debuginfo] target(s) in 3.08s
📦 Built wheel for CPython 3.9 to /Users/rseymour/src/whatever/target/wheels/whatever-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
   Compiling pyo3-build-config v0.16.5
   Compiling pyo3-ffi v0.16.5
   Compiling pyo3 v0.16.5
arg    Building [========================>  ] 40/42: pyo3
   Compiling whatever v0.1.0 (/Users/rseymour/src/whatever)
    Finished dev [unoptimized + debuginfo] target(s) in 2.71s
📦 Built wheel for CPython 3.10 to /Users/rseymour/src/whatever/target/wheels/whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl

~/src/whatever 6s
[9:12:59] mat ❯ cd target/wheels

~/src/whatever/target/wheels
[9:13:11] mat ❯ ls
whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl whatever-0.1.0-cp39-cp39-macosx_11_0_arm64.whl   whatever-0.1.0.tar.gz

~/src/whatever/target/wheels
[9:13:13] mat ❯ pip install whatever-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
ERROR: whatever-0.1.0-cp39-cp39-macosx_11_0_arm64.whl is not a supported wheel on this platform.

~/src/whatever/target/wheels
[9:13:32] mat ❯ pip install whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
ERROR: whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl is not a supported wheel on this platform.

~/src/whatever/target/wheels
[9:13:43] mat ❯ unzip whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Archive:  whatever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
  inflating: whatever-0.1.0.dist-info/METADATA
  inflating: whatever-0.1.0.dist-info/WHEEL
  inflating: whatever/__init__.py
  inflating: whatever/whatever.cpython-310-darwin.so
  inflating: whatever-0.1.0.dist-info/RECORD

~/src/whatever/target/wheels
[9:13:53] mat ❯ file whatever/whatever.cpython-310-darwin.so
whatever/whatever.cpython-310-darwin.so: Mach-O 64-bit dynamically linked shared library arm64

not sure why pip is mad. I'm assuming conda is angry with me for not really knowing how to use it, but I don't understand how a .so for arm64 doesn't run on an M1 laptop all of the sudden...

~/src/whatever/target/wheels
[9:14:57] mat ❯ which python
/opt/homebrew/anaconda3/envs/mat/bin/python

~/src/whatever/target/wheels
[9:15:20] mat ❯ file /opt/homebrew/anaconda3/envs/mat/bin/python
/opt/homebrew/anaconda3/envs/mat/bin/python: Mach-O 64-bit executable x86_64

oh. that explains it.

I'm submitting this as a solved bug. I'm not a conda pro, so I figured conda update --all was self referential. alas. "all" sometimes means "all but the interpreter"

The fix is:

conda deactivate # just in case you're in a conda environment
conda install anaconda=2022.05 # as of today 2022-06-23 

Your Python version (python -V)

Python 3.10.4

Your pip version (pip -V)

pip 21.2.4

What bindings you're using

cffi

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

listed above, this is just a bug showing how an old anaconda on an M1 machine can install a x86 python and make a working rust build seem like its broken!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions