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

musllinux wheel missing #1996

Open
jrauschenbusch opened this issue Feb 22, 2024 · 7 comments
Open

musllinux wheel missing #1996

jrauschenbusch opened this issue Feb 22, 2024 · 7 comments

Comments

@jrauschenbusch
Copy link

Expected behavior and actual behavior.

There should be a wheel for musllinux, to speed up CI build times significantly when using Alpine-based Python base images.

Steps to reproduce the problem.

pip install shapely => Builds from source instead of using a pre-built wheel for musllinux

Operating system

Alpine Linux, x86_64

Shapely version and provenance

Until at least 2.0.3

@jrauschenbusch jrauschenbusch changed the title muslinux wheel muslinux wheel missing Feb 22, 2024
@mwtoews mwtoews changed the title muslinux wheel missing musllinux wheel missing Feb 22, 2024
@mwtoews
Copy link
Member

mwtoews commented Feb 22, 2024

Looking at NumPy binary wheels on PyPI, I can see that musllinux wheels are available since numpy>=1.25 and for cp39 and later.

@mbacarella
Copy link

To be more verbose, I believe the issue here is that shapely takes a long time to build because it depends on numpy.

While numpy has wheels for Alpine, they only start at numpy version 1.25.

shapely's pyproject.toml, however, allows this constraint for numpy:

"numpy>=1.14,<2",

That constraint allows installing numpy 1.24, which, again on Alpine, ends up building numpy from source.

The fix is to constrain to numpy >=1.25 so that it finds the binary wheel. To meet the criteria for that version of numpy, we need to drop support for Python 3.7 and 3.8.

The patch is something like this:

diff --git a/pyproject.toml b/pyproject.toml
index b053dfc..b4d727f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -28,17 +28,15 @@ classifiers = [
     "Operating System :: MacOS",
     "Operating System :: Microsoft :: Windows",
     "Programming Language :: Python :: 3",
-    "Programming Language :: Python :: 3.7",
-    "Programming Language :: Python :: 3.8",
     "Programming Language :: Python :: 3.9",
     "Programming Language :: Python :: 3.10",
     "Programming Language :: Python :: 3.11",
     "Programming Language :: Python :: 3.12",
     "Topic :: Scientific/Engineering :: GIS",
 ]
-requires-python = ">=3.7"
+requires-python = ">=3.9"
 dependencies = [
-    "numpy>=1.14,<2",
+    "numpy>=1.25,<2",
 ]

 [project.optional-dependencies]

@mbacarella
Copy link

That is, I think installing shapely would be acceptably fast on Alpine if it used the numpy wheel.

@mwtoews
Copy link
Member

mwtoews commented Feb 29, 2024

Adding musllinux isn't too difficult to enable, as it is well-supported by cibuildwheel. Perhaps it's just the timing of the availability. It is probably best to wait for shapely 2.1, which doesn't have any planned release deadline (yet). But it could be considered for an upcoming shapely 2.0 maintenance release, if there is significant demand.

@jrauschenbusch
Copy link
Author

Waiting is fine. Drop of Python <3.9 support should be handled well and announced in some way maybe. It's not an urgent thing. But musllinux support will save a lot of time and compute resources for Alpine based environments.

@jorisvandenbossche
Copy link
Member

To be more verbose, I believe the issue here is that shapely takes a long time to build because it depends on numpy.

While numpy has wheels for Alpine, they only start at numpy version 1.25.

shapely's pyproject.toml, however, allows this constraint for numpy:

Just noting that this version constraint itself is also already changed on the main branch to numpy>=1.25 (for building), and so that means that for shapely 2.1, even if we don't add musllinux wheels for shapely itself, at least it should already start using the numpy wheel when building

But also agreed that it might be rather straightforward to add musllinux wheels with cibuildwheel. Only our install_geos.sh script might need some changes, although I don't directly see anything linux-distribution specific in there (which is actually logical as it also works for mac)

@jrauschenbusch
Copy link
Author

Are there now plans for 2.1?

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

No branches or pull requests

4 participants