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

The wasmer_compiler_cranelift package doesn't work on M1 #657

Open
Michael-F-Bryan opened this issue Nov 9, 2022 · 7 comments
Open

The wasmer_compiler_cranelift package doesn't work on M1 #657

Michael-F-Bryan opened this issue Nov 9, 2022 · 7 comments
Labels
🐞 bug Something isn't working

Comments

@Michael-F-Bryan
Copy link

Describe the bug

Trying to import the wasmer_compiler_cranelift library (or any of the compilers) on an M1 will unconditionally trigger an ImportError.

raise ImportError("Wasmer is not available on this system")

CC: @ayys

@Michael-F-Bryan Michael-F-Bryan added the 🐞 bug Something isn't working label Nov 9, 2022
@ayys
Copy link
Member

ayys commented Nov 9, 2022

possible duplicate of #539

@ayys
Copy link
Member

ayys commented Nov 10, 2022

I was able to get wasmer running from python on my M1.

uname -a
Darwin Micu.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64

Previously, I was getting this error

In [1]: import wasmer
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import wasmer

File /opt/homebrew/lib/python3.10/site-packages/wasmer/__init__.py:1, in <module>
----> 1 raise ImportError("Wasmer is not available on this system")

ImportError: Wasmer is not available on this system

Using my locally compiled version of this repo, I can now import wasmer.

In [1]: import wasmer

In [2]: wasmer.Store
Out[2]: Store

To get this running, I went through the development setup guide in readme, except I made the following change

diff --git a/justfile b/justfile
index 22742a3..c2823d3 100644
--- a/justfile
+++ b/justfile
@@ -65,7 +65,7 @@ build package='api' rust_target=`rustc -vV | awk '/^host/ { print $2 }'`:

         cd packages/{{package}}/

-        maturin develop --binding-crate pyo3 --release --strip --cargo-extra-args="${build_args}"
+        maturin develop --binding-crate pyo3 --release --strip

 # Build all the wheels.
 build-all-wheels python_version rust_target:

If I keep the --cargo-extra-args flag, I get the following error when running just build api

just build api
Build arguments:  --target aarch64-apple-darwin
error: Found argument '--cargo-extra-args' which wasn't expected, or isn't valid in this context

	If you tried to supply `--cargo-extra-args` as a value rather than a flag, use `-- --cargo-extra-args`

USAGE:
    maturin develop --bindings <BINDINGS> --release --strip

For more information try --help
error: Recipe `build` failed with exit code 2

@Michael-F-Bryan
Copy link
Author

Hmm... it's really strange that everything worked after you recompiled. We've committed Cargo.lock, so it's not like cargo is using a different version of wasmer.

I'm not too familiar with how the wasmer package figures out which compiler to use, but I'm guessing a good place to start would be finding that logic, and in particular what makes it fall back to importing any-api.

That --cargo-extra-args thing is probably a red herring. From their changelog, it seems like --cargo-extra-args was removed in Maturin 0.13.0.

@cch0
Copy link

cch0 commented Jun 23, 2023

I am seeing the same issue on M1.

  • Saw the same error after doing import wasmer
  • Followed the instruction to compile and then no error after doing import wasmer.

@cch0
Copy link

cch0 commented Jun 23, 2023

Actually, according to README, Darwin + arm64 is not yet supported which makes sense for error.

@qartik
Copy link

qartik commented Oct 3, 2023

I just tried installing wasmer-python 1.2.0 directly from master. It seems to work fine on my M2 machine.

Can we expect a release soon? @ayys

@pachacamac
Copy link

seems to work with python version 3.9 on Apple M1

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

5 participants