Skip to content
Latchkey

pip "Cargo, the Rust package manager, is not installed"

A package with a Rust extension (cryptography, pydantic-core, orjson) had no prebuilt wheel for your platform, so pip tried to compile it from source - which needs a Rust toolchain the runner does not have.

What this error means

During install pip reports that the package requires Rust and that Cargo is not installed, with a link to rustup. The pure-Python part is fine; the native Rust build cannot proceed without a compiler.

pip output
error: can't find Rust compiler

If you are using an outdated pip version, ... a binary wheel is available ...
This package requires Rust >=1.63 and Cargo to build. ...
ERROR: Failed building wheel for cryptography

Common causes

No wheel for this platform/Python

On musl/Alpine, an exotic arch, or a brand-new Python, there may be no prebuilt wheel, so pip falls back to compiling the Rust extension.

Outdated pip not seeing the wheel

An old pip can fail to select an available manylinux wheel and unnecessarily attempt a source build.

How to fix it

Upgrade pip and prefer the wheel

A current pip usually finds a prebuilt wheel and skips Rust entirely.

Terminal
python -m pip install --upgrade pip
pip install --only-binary :all: cryptography

Install Rust if you must build from source

Terminal
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
pip install cryptography

How to prevent it

  • Use glibc base images where manylinux wheels are available.
  • Keep pip current so it selects prebuilt wheels.
  • Bake the Rust toolchain into images that genuinely need source builds.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →