Writing

The Wheel Exists, So Why Won't It Install? A glibc/manylinux Lesson and uv Dependency Management in a Python 3.12 Upgrade

2026-06-09

9 mins to read

Share article

In one sentence: a Python 3.12 upgrade plus a pip → uv migration that "should have taken 10 minutes" turned, on an end-of-life CentOS 7 (glibc 2.17) server, into a deep investigation of wheel / manylinux / glibc ABI compatibility. This article explains why a wheel can clearly exist and still refuse to install, and how uv turns dependency management into a reproducible, self-healing engineering capability.

1. A task that "should take 10 minutes"

I maintain an AI agent service running in production: FastAPI + LangGraph, wired up to several LLM providers, with a Milvus vector store behind it. Its dependencies had always lived in a hand-maintained requirements.txt. This time I had two seemingly routine things to do:

  1. Upgrade the runtime from Python 3.11 to 3.12;
  2. Migrate dependency management from pip to uv.

If you come from the frontend world, this mapping gives you the intuition:

Python / uvFrontend / npmPurpose
pyproject.tomlpackage.jsonDeclares dependencies, version constraints, and the package index
uv.lockpackage-lock.jsonLocks the full transitive dependency tree to exact versions
uv sync --frozennpm ciRestores the environment strictly from the lockfile, without re-resolving
uv add xxxnpm install xxxAdds a dependency and updates the lockfile

Why migrate at all? A hand-maintained requirements.txt has no lockfile. The resulting dependency tree depends on install order and on the environment, so environments drift apart — the classic "works on my machine, breaks in production".

2. The first wall: the wheel exists, yet it "can't be installed"

With the uv migration done, the very first uv sync on the server got stuck:

error: Distribution `onnxruntime==1.26.0` can't be installed because it doesn't have a source distribution or wheel for the current platform
hint: You're on Linux (`manylinux_2_17_x86_64`), but `onnxruntime` only has wheels for: manylinux_2_27 / manylinux_2_28 ...

To make sense of this error, you need three concepts first:

  • A wheel is Python's precompiled binary package, and its filename carries its own "birth certificate". Take onnxruntime-1.17.0-cp312-cp312-manylinux_2_27_x86_64.whl: cp312 means it was built for Python 3.12, and manylinux_2_27 means it requires glibc ≥ 2.27.
  • manylinux is a family of compatibility tags meant to make wheels "run on old Linux too" (PEP 600). manylinux_2_X is a hard requirement of glibc ≥ 2.X, not a suggestion. manylinux2014 = glibc 2.17.
  • glibc is only backward compatible: a machine with a newer glibc can install wheels built for an older glibc, but not the other way around.

My server was CentOS 7 = glibc 2.17 (confirmed with ldd --version). And every onnxruntime release that ships a cp312 build has only manylinux_2_27 wheels for Linux x86_64 — hence the failure.

It gets worse:

The combination "cp312 + glibc 2.17" simply does not exist. The onnxruntime version that installs on CentOS 7 (1.16.3) has no cp312 build; the versions that do have cp312 (1.17.0 onward) require glibc ≥ 2.27. Downgrading can't save you either.

What about building from source? I checked the toolchain: gcc 4.8.5 (from 2015), an empty /opt/rh, no devtoolset. pandas needs Cython + meson, and rapidfuzz needs C++17 — that old gcc can't build any of it. The source route was a dead end too.

3. The turning point: this isn't a technical problem, it's a product problem

The technical layer was a dead end. At that moment, the most important call was: stop hammering on the dead end, step back one layer, and ask whether the constraint itself can be relaxed.

I went to find out who was pulling onnxruntime in. It turned out to be the project's image/document OCR feature (rapidocr-onnxruntime / rapidocr-paddle, both of which sit on top of Microsoft's inference engine, onnxruntime).

So the question changed from "how do I install onnxruntime on glibc 2.17" into a product go/no-go decision: is this OCR feature still in use?

Once I confirmed it had been deprecated, I commented out those two OCR packages in pyproject.toml, and onnxruntime dropped out of the entire dependency tree along with them. As far as onnxruntime was concerned, Python 3.12 was unblocked.

This step was the most important engineering judgment in the whole story: when a constraint has no solution at the current technical layer, the right move is often not to work harder at the technical puzzle, but to step back and ask "could we simply not need this requirement at all?" Recognizing a go/no-go is worth more than grinding through a dead end.

4. The second wall: onnxruntime wasn't the only landmine

After removing OCR, I ran uv sync again and hit faiss-cpu (it doesn't even publish an sdist, so it fails hard right away). I then scanned the whole uv.lock against the target platform (cp312 / glibc 2.17 / x86_64) and found that recent versions of pandas / greenlet / rapidfuzz / ujson were also missing glibc 2.17 wheels.

This time I didn't SSH in and firefight them one by one. Instead I encoded the platform constraint into the dependency declarations, using two different kinds of tools:

PackageTreatmentWhy
faiss-cpu (pulled in via milvus-lite)Removed from the tree entirely via override-dependencies with an always-false markerThe chain is pymilvus → milvus-lite (local embedded mode) → faiss-cpu; this project only connects to a remote Milvus and there is no import faiss anywhere in the repo, so this chain was never used
pandasPinned <2.3 → 2.2.32.2.x is the last line that publishes manylinux2014 wheels
greenletPinned <3.2 → 3.1.1Required by SQLAlchemy; from 3.2 on, wheels are raised to glibc 2.24
rapidfuzzPinned <3.13 → 3.12.2Required by unstructured; from 3.13 on, raised to glibc 2.27
ujsonPinned <5.11 → 5.10.0Required by pymilvus; newer versions are raised to glibc 2.24

The last four are pinned with constraint-dependencies. There's a distinction here that often gets blurred:

  • constraint-dependencies (constraints): "if this package is used, its version must satisfy the constraint". It will not pull in any package on its own; it only narrows the version range when an existing dependency is being resolved. ≈ using npm's overrides to "narrow a version".
  • override-dependencies (overrides): forcibly rewrites what someone else in the dependency tree declares about a package. Combined with an always-false marker (sys_platform == 'never', which is true on no platform), it lets you cut out an entire unused chain.

The result: uv sync --frozen finishes in seconds with zero C compilation — no Docker, no OS upgrade.

A precision correction (and a matter of honesty): strictly speaking, it isn't "pure wheels all the way". Of the 161 installed packages, 156 are precompiled wheels and the other 5 are pure-Python sdists (oss2 / aliyun-python-sdk-core / crcmod / memoization / langdetect), which get a lightweight build on the spot but need no compiler. The accurate claim is "zero C compilation", not "pure wheels". In technical writing, that kind of precision matters more than a pretty conclusion.

5. Why uv instead of sticking with pip

Getting the dependencies installed was just the outcome. I chose uv because it turns "reproducible" into an engineering capability you can put in a pipeline:

  • Reproducible via lockfile: any environment built from uv.lock gets exactly the same dependency tree, which eliminates drift.
  • uv sync --frozen is idempotent: it compares .venv with uv.lock; if they match, it's a no-op that returns in seconds, and only when they differ does it install the delta — so you can run it on every deploy. You wouldn't dare use pip that way, because it runs through everything even when nothing changed, and it's slow. (It's the same relationship as npm ci to npm install.)
  • Configuration in one place: the Python version constraint (requires-python = ">=3.12,<3.13"), the package index, and the platform constraints are all declared in a single pyproject.toml.

That last point leads directly to "self-healing dependencies": add uv sync --frozen --no-dev to the deployment pipeline, and from then on, when I change dependencies locally with uv add and commit the lockfile, the server catches up automatically at deploy time. No more SSHing in to install things by hand.

6. Going live: a gradual cutover + a classic process-management pitfall

This service is deployed in a very "traditional" way: Jenkins only rsyncs the source code, supervisor manages the process, and dependencies live in a venv local to the server (not in git).

Gradual cutover: uv installs a standalone Python 3.12 in user space (without touching the system python), and the new .venv coexists with the old venv. Switching over only requires pointing command / PATH in the supervisor config from venv to .venv — an atomic, reversible action. Rollback = restoring the backed-up conf. It's close to a blue-green deployment.

Then I walked into a classic pitfall: after switching to .venv and restarting, the service started flapping — status showed RUNNING for a moment, the pid kept changing, and it finally ended up FATAL. The investigation:

  • ss -ltnp filtered on the service port → a batch of old python processes were still holding that port;
  • ps showed them with PPID=1 and a cmdline of multiprocessing-fork → orphaned workers.

Root cause: in uvicorn's multi-worker mode, the master spawns several workers, but by default supervisor only sends the stop signal to the master and doesn't reap the workers. On restart, the old workers became orphans and kept holding the service port → the new master failed to bind and exited → autorestart retried over and over until FATAL. (The old single-process code never exposed this; it only became real with multiple workers. On top of that, the process's stderr wasn't being written anywhere at the time, which swallowed the address already in use error, so for a while I couldn't even see it.)

The fix: add stopasgroup=true + killasgroup=true to the supervisor conf so that it reaps the master and workers together as a process group. For the one-off orphan cleanup, I used pkill -f with a pattern that matches exactly this app's .venv path (to avoid hitting any other process).

7. The last mile: the test and production machines differ too

The test machine is CentOS 7 (glibc 2.17), but the production machine is Ubuntu 24.04 (glibc 2.39). glibc 2.39 is backward compatible with the manylinux2014 wheels pinned for 2.17, so production is actually easier to install on. But the key discipline is this:

Production must use uv sync --frozen; re-resolving is forbidden. Otherwise, on Ubuntu with its newer glibc, the resolver would pick newer wheels and install a dependency set that differs from the test machine — and "it passed testing" would stop meaning anything. The value of a lockfile only truly shows when the two machines' environments differ like this.

8. Takeaways and honest technical debt

A few reusable principles:

  1. When a constraint has no solution at one layer, step back a layer (from technical to a product go/no-go).
  2. Encode platform constraints into the lockfile, rather than relying on someone SSHing in to firefight by hand.
  3. Gradual rollout + atomic switch + easy rollback keep the blast radius of a release as small as possible.
  4. Lockfile-driven deployment = self-healing dependencies: it removes the human-factor risk of "don't forget to install the dependencies manually" from the process.

The technical debt left behind deserves an honest record too: pinning 4 packages to old versions is accommodating an end-of-life CentOS 7 box. The clean long-term answer is containerization (the python:3.12 image ships with glibc 2.36) or an OS upgrade. Those are tracked as separate follow-ups and were deliberately kept out of this migration.

A closing note (from an AI engineering perspective): AI projects are inherently heavier on dependencies — ML-native packages like torch / onnxruntime / faiss are extremely sensitive to glibc, CUDA, and the build toolchain. So in AI engineering, "reproducible dependency management" isn't a nice-to-have; it's the foundation. Whether a model runs consistently on the target machine often depends not on the model itself, but on whether you've locked the environment down. That's my biggest takeaway from this whole exercise.