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

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

Closed
1 of 2 tasks
rseymour opened this issue Jun 24, 2022 · 3 comments
Closed
1 of 2 tasks

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

rseymour opened this issue Jun 24, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@rseymour
Copy link

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!

@rseymour rseymour added the bug Something isn't working label Jun 24, 2022
@rseymour
Copy link
Author

closing so no one thinks this is a real issue, just documentation on a unique mix-up on my part.

@messense
Copy link
Member

This is actually the same kind of issue as #979 and it's fixed in #980.

Previously because maturin develop has no --target option, it relies on rustc -vV to get the host target as target triple, after #980 it will also look at the architecture of current Python interpreter on macOS.

@rseymour
Copy link
Author

Right it's the same mismatch, where if I'd had a rust cross compile toolchain setup I might not have noticed? Also for folks finding this, the right command for me was brew upgrade anaconda since I had installed via brew, not the internal anaconda update (which fails for me trying to solve dependency constraints)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants