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

PyPI package does not work on Alpine #237

Closed
whitequark opened this issue May 20, 2024 · 10 comments · Fixed by #242
Closed

PyPI package does not work on Alpine #237

whitequark opened this issue May 20, 2024 · 10 comments · Fixed by #242

Comments

@whitequark
Copy link
Contributor

To reproduce:

$ docker run --network=host -it alpine:latest
/ # apk add py3-pip
/ # cd /root
~ # python -m venv venv
~ # . venv/bin/activate
(venv) ~ # pip install wasmtime
Collecting wasmtime
  Downloading wasmtime-21.0.0-py3-none-any.whl.metadata (7.4 kB)
Collecting importlib-resources>=5.10 (from wasmtime)
  Downloading importlib_resources-6.4.0-py3-none-any.whl.metadata (3.9 kB)
Downloading wasmtime-21.0.0-py3-none-any.whl (4.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.4/4.4 MB 8.8 MB/s eta 0:00:00
Downloading importlib_resources-6.4.0-py3-none-any.whl (38 kB)
Installing collected packages: importlib-resources, wasmtime
Successfully installed importlib-resources-6.4.0 wasmtime-21.0.0
(venv) ~ # python
Python 3.11.9 (main, Apr 14 2024, 13:40:00) [GCC 13.2.1 20231014] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wasmtime
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/venv/lib/python3.11/site-packages/wasmtime/__init__.py", line 17, in <module>
    from ._error import WasmtimeError, ExitTrap
  File "/root/venv/lib/python3.11/site-packages/wasmtime/_error.py", line 2, in <module>
    from . import _ffi as ffi
  File "/root/venv/lib/python3.11/site-packages/wasmtime/_ffi.py", line 30, in <module>
    raise RuntimeError("precompiled wasmtime binary not found at `{}`".format(filename))
RuntimeError: precompiled wasmtime binary not found at `/root/venv/lib/python3.11/site-packages/wasmtime/linux-x86_64/_libwasmtime.so`

The root cause is that the manylinux wheels that are currently published are based on glibc, but Alpine is based on musl libc. There is a separate musllinux platform tag that can be used in that case.

Do you think musl-compatible builds could be added? This would improve compatibility with certain distributions like Alphine Linux, Void Linux, and others focusing on size and speed.

@alexcrichton
Copy link
Member

Is there a python target which is "not glibc" and/or "only musl libc"? Or would all linux users need to switch over to a musl-based version?

I'll also note that we haven't yet added musl/alpine releases for Wasmtime itself and this repo pulls from the artifacts produced in Wasmtime itself so that might be a prerequisite here too

@sdomi
Copy link

sdomi commented May 20, 2024

It's musllinux, as per https://peps.python.org/pep-0656/ - this can be a separate build from manylinux, especially since you already ship different wheels per architecture and system.

alexcrichton added a commit to alexcrichton/wasmtime that referenced this issue May 21, 2024
This was requested in bytecodealliance/wasmtime-py#237 and shouldn't
cost us too much in terms of CI resources and maintenance overhead.
@alexcrichton
Copy link
Member

Nice! I believe with that there'd be a new addition of musllinux_1_2_x86_64 here. I added building of Wasmtime binaries to bytecodealliance/wasmtime#8668.

@whitequark do you need any other platforms other than x86_64? It'll be significantly more difficult getting other musl-based architectures working since we'd have to build our own toolchain which is generally not an easy thing to architect for CI

github-merge-queue bot pushed a commit to bytecodealliance/wasmtime that referenced this issue May 21, 2024
This was requested in bytecodealliance/wasmtime-py#237 and shouldn't
cost us too much in terms of CI resources and maintenance overhead.
@whitequark
Copy link
Contributor Author

do you need any other platforms other than x86_64?

That should cover the vast majority of use cases. I can see someone wanting arm64 for Alpine on Apple M1 eventually, but that's a niche of a niche and I don't think we need to care about this now. Thanks!

github-merge-queue bot pushed a commit to bytecodealliance/wasmtime that referenced this issue May 21, 2024
* Add release binaries for x86_64-musl

This was requested in bytecodealliance/wasmtime-py#237 and shouldn't
cost us too much in terms of CI resources and maintenance overhead.

* Fix combining rustflags

prtest:full
alexcrichton added a commit to alexcrichton/wasmtime-py that referenced this issue May 21, 2024
alexcrichton added a commit that referenced this issue May 21, 2024
* Add a wheel for `musllinux_1_2_x86_64`

Use binaries from bytecodealliance/wasmtime#8668 to add a musl wheel.

cc #237

* Fix download script

* Comment different version of version used for musl

* Simplify installation of wasm-tools on CI

* Don't cache the registry any more

Cargo's default heuristics nowadays are better than the caching.

* Update some github actions versions
@alexcrichton
Copy link
Member

@whitequark can you test this release and see if it works for you?

@sdomi
Copy link

sdomi commented May 21, 2024

@alexcrichton tested, can verify that it works for me :)

@alexcrichton
Copy link
Member

alexcrichton commented May 21, 2024

Awesome, thanks! Is this something where you'd like to see that as a 21.0.1 release? Or is waiting until April June 20 for the Wasmtime 22 release ok?

@whitequark
Copy link
Contributor Author

(Do you mean June?)

@alexcrichton
Copy link
Member

Oops sorry, yes, I mean June.

@whitequark
Copy link
Contributor Author

whitequark commented May 22, 2024

I think that's fine--we get folks on musl-based distros occasionally but it's not a lot and you don't need to go through the trouble of making a release. Thanks for offering!

(I guess this issue could be closed once there's a release?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants