Skip to content

Install crashes on ARM with Musl (e.g. RPi + Alpine) #1721

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

Open
latekvo opened this issue May 26, 2025 · 3 comments · May be fixed by #1725
Open

Install crashes on ARM with Musl (e.g. RPi + Alpine) #1721

latekvo opened this issue May 26, 2025 · 3 comments · May be fixed by #1725

Comments

@latekvo
Copy link

latekvo commented May 26, 2025

Installation of pydantic-core>=2.0.0 crashes on ARM platforms with Musl libc linux running as the kernel.
This is due to:

  1. Pydantic does not ship a py wheel of pydantic-core for cpython-312-arm-linux-musleabihf
  2. Rust supports arm-unknown-linux-musleabihf as a "Tier 2" architecture. Despite "Tier 2" architectures being theoritically supported, at the time of testing, no pre-compiled toolkits were available for this platform.

This issue can be fixed by adding a wheel for cpython-312-arm-linux-musleabihf.

This is kind of a big deal, as Raspberry Pi with Alpine is a pretty popular setup (it's extremely tiny and memory efficient), and pydantic is quite essential for most python projects.
Also, while I'm aware that most python packages do not ship their wheels with this kind of broad platform support, it would be nice to hold pydantic to a higher standard, since it's so widely used in other packages as well.

Exact pydantic-core versions tested:

  • pydantic_core==2.33.2: failing
  • pydantic_core==1.10.22: working well

Exact error message:

Collapsed error log
$ pip install -r requirements.txt
Collecting aiohappyeyeballs==2.4.6 (from -r requirements.txt (line 1))
  Using cached aiohappyeyeballs-2.4.6-py3-none-any.whl.metadata (5.9 kB)
Collecting aiohttp==3.11.12 (from -r requirements.txt (line 2))
  Using cached aiohttp-3.11.12.tar.gz (7.7 MB)
  Installing build dependencies ... done

[......]

  Preparing metadata (pyproject.toml) ... done
Collecting pydantic==2.10.6 (from -r requirements.txt (line 32))
  Using cached pydantic-2.10.6-py3-none-any.whl.metadata (30 kB)
Collecting pydantic_core==2.27.2 (from -r requirements.txt (line 33))
  Using cached pydantic_core-2.27.2.tar.gz (413 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      Python reports SOABI: cpython-312-arm-linux-musleabihf
      Computed rustc target triple: arm-unknown-linux-musleabihf
      Target triple not supported by rustup: arm-unknown-linux-musleabihf
      Checking for Rust toolchain....
      Rust not found, installing into a temporary directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 25.0.1 -> 25.1.1
[notice] To update, run: pip install --upgrade pip
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Full requirements.txt file at the time of failure:

Collapsed file
aiohappyeyeballs==2.6.1
aiohttp==3.11.18
aiosignal==1.3.2
annotated-types==0.7.0
anyio==4.9.0
attrs==25.3.0
certifi==2025.4.26
charset-normalizer==3.4.2
dataclasses-json==0.6.7
frozenlist==1.6.0
greenlet==3.2.2
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
httpx-sse==0.4.0
idna==3.10
jsonpatch==1.33
jsonpointer==3.0.0
langchain==0.3.25
langchain-community==0.3.24
langchain-core==0.3.60
langchain-text-splitters==0.3.8
langsmith==0.3.42
marshmallow==3.26.1
multidict==6.4.4
mypy_extensions==1.1.0
numpy==2.2.6
orjson==3.10.18
packaging==24.2
propcache==0.3.1
pydantic==2.11.4
pydantic-settings==2.9.1
pydantic_core==2.33.2
python-dotenv==1.1.0
PyYAML==6.0.2
requests==2.32.3
requests-toolbelt==1.0.0
sniffio==1.3.1
SQLAlchemy==2.0.41
tenacity==9.1.2
typing-inspect==0.9.0
typing-inspection==0.4.0
typing_extensions==4.13.2
urllib3==2.4.0
yarl==1.20.0
zstandard==0.23.0
@davidhewitt
Copy link
Contributor

Rust supports arm-unknown-linux-musleabihf as a "Tier 2" architecture. Despite "Tier 2" architectures being theoritically supported, at the time of testing, no pre-compiled toolkits were available for this platform.

If I follow correctly what you mean here, while it's possible to cross-compile to the architecture you are saying there is no prebuilt rust host you can download and run on that platform?

@latekvo
Copy link
Author

latekvo commented May 27, 2025

If I follow correctly what you mean here, while it's possible to cross-compile to the architecture you are saying there is no prebuilt rust host you can download and run on that platform?

Rust itself is available on this platform, but there isn't a compatible Rust toolchain binary available.

To be precise:

  1. pydantic-core does not provide a wheel compatible with ARMv6l + linux + musl
  2. This means python tries to compile it's own wheel during installation.
  3. Compilation of the wheel fails, as rust does not provide a pre-build binary of a toolchain compatible with arm-unknown-linux-musleabihf
  4. To solve this, I'd have to compile the toolchain from source.
  5. This means, that to use pydantic-core, i'd have to compile the missing toolchain from source, then compile the pydantic-core package from source (the latter should be done automatically by pip)

@davidhewitt
Copy link
Contributor

Possibly blocked on PyO3/maturin-action#354

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.

2 participants