[{"data":1,"prerenderedAt":927},["ShallowReactive",2],{"\u002Farticles\u002Fpython-312-uv-glibc":3},{"id":4,"title":5,"body":6,"date":909,"description":910,"extension":911,"head":912,"image":913,"meta":914,"navigation":915,"ogImage":912,"path":916,"rating":917,"readingTime":918,"robots":912,"schemaOrg":912,"seo":919,"sitemap":920,"stem":921,"tags":922,"__hash__":926},"articles_en\u002Farticles\u002Fpython-312-uv-glibc.md","The Wheel Exists, So Why Won't It Install? A glibc\u002Fmanylinux Lesson and uv Dependency Management in a Python 3.12 Upgrade",{"type":7,"value":8,"toc":899},"minimark",[9,33,38,53,71,74,161,167,171,178,201,204,253,267,270,282,296,300,306,321,330,340,349,353,370,377,492,499,538,548,583,587,594,643,654,658,661,690,718,731,756,771,794,798,809,829,833,836,862,873,895],[10,11,12],"note",{},[13,14,15,19,20,24,25,28,29,32],"p",{},[16,17,18],"strong",{},"In one sentence",": a Python 3.12 upgrade plus a ",[21,22,23],"code",{},"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 ",[16,26,27],{},"wheel \u002F manylinux \u002F glibc ABI compatibility",". This article explains why a wheel can clearly exist and still refuse to install, and how ",[16,30,31],{},"uv"," turns dependency management into a reproducible, self-healing engineering capability.",[34,35,37],"h2",{"id":36},"_1-a-task-that-should-take-10-minutes","1. A task that \"should take 10 minutes\"",[13,39,40,41,44,45,48,49,52],{},"I maintain an AI agent service running in production: ",[21,42,43],{},"FastAPI"," + ",[21,46,47],{},"LangGraph",", wired up to several LLM providers, with a Milvus vector store behind it. Its dependencies had always lived in a hand-maintained ",[21,50,51],{},"requirements.txt",". This time I had two seemingly routine things to do:",[54,55,56,64],"ol",{},[57,58,59,60,63],"li",{},"Upgrade the runtime from Python ",[16,61,62],{},"3.11 to 3.12",";",[57,65,66,67,70],{},"Migrate dependency management from ",[16,68,69],{},"pip to uv",".",[13,72,73],{},"If you come from the frontend world, this mapping gives you the intuition:",[75,76,77,93],"table",{},[78,79,80],"thead",{},[81,82,83,87,90],"tr",{},[84,85,86],"th",{},"Python \u002F uv",[84,88,89],{},"Frontend \u002F npm",[84,91,92],{},"Purpose",[94,95,96,112,131,146],"tbody",{},[81,97,98,104,109],{},[99,100,101],"td",{},[21,102,103],{},"pyproject.toml",[99,105,106],{},[21,107,108],{},"package.json",[99,110,111],{},"Declares dependencies, version constraints, and the package index",[81,113,114,119,124],{},[99,115,116],{},[21,117,118],{},"uv.lock",[99,120,121],{},[21,122,123],{},"package-lock.json",[99,125,126,127,130],{},"Locks the ",[16,128,129],{},"full transitive dependency tree"," to exact versions",[81,132,133,138,143],{},[99,134,135],{},[21,136,137],{},"uv sync --frozen",[99,139,140],{},[21,141,142],{},"npm ci",[99,144,145],{},"Restores the environment strictly from the lockfile, without re-resolving",[81,147,148,153,158],{},[99,149,150],{},[21,151,152],{},"uv add xxx",[99,154,155],{},[21,156,157],{},"npm install xxx",[99,159,160],{},"Adds a dependency and updates the lockfile",[13,162,163,164,166],{},"Why migrate at all? A hand-maintained ",[21,165,51],{}," 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\".",[34,168,170],{"id":169},"_2-the-first-wall-the-wheel-exists-yet-it-cant-be-installed","2. The first wall: the wheel exists, yet it \"can't be installed\"",[13,172,173,174,177],{},"With the uv migration done, the very first ",[21,175,176],{},"uv sync"," on the server got stuck:",[179,180,185],"pre",{"className":181,"code":182,"language":183,"meta":184,"style":184},"language-txt shiki shiki-themes github-light github-dark github-dark","error: Distribution `onnxruntime==1.26.0` can't be installed because it doesn't have a source distribution or wheel for the current platform\nhint: You're on Linux (`manylinux_2_17_x86_64`), but `onnxruntime` only has wheels for: manylinux_2_27 \u002F manylinux_2_28 ...\n","txt","",[21,186,187,195],{"__ignoreMap":184},[188,189,192],"span",{"class":190,"line":191},"line",1,[188,193,194],{},"error: Distribution `onnxruntime==1.26.0` can't be installed because it doesn't have a source distribution or wheel for the current platform\n",[188,196,198],{"class":190,"line":197},2,[188,199,200],{},"hint: You're on Linux (`manylinux_2_17_x86_64`), but `onnxruntime` only has wheels for: manylinux_2_27 \u002F manylinux_2_28 ...\n",[13,202,203],{},"To make sense of this error, you need three concepts first:",[205,206,207,229,247],"ul",{},[57,208,209,210,213,214,217,218,221,222,225,226,70],{},"A ",[16,211,212],{},"wheel"," is Python's precompiled binary package, and its filename carries its own \"birth certificate\". Take ",[21,215,216],{},"onnxruntime-1.17.0-cp312-cp312-manylinux_2_27_x86_64.whl",": ",[21,219,220],{},"cp312"," means it was built for Python 3.12, and ",[21,223,224],{},"manylinux_2_27"," means it requires ",[16,227,228],{},"glibc ≥ 2.27",[57,230,231,234,235,238,239,242,243,246],{},[16,232,233],{},"manylinux"," is a family of compatibility tags meant to make wheels \"run on old Linux too\" (PEP 600). ",[21,236,237],{},"manylinux_2_X"," is a ",[16,240,241],{},"hard requirement"," of glibc ≥ 2.X, not a suggestion. ",[21,244,245],{},"manylinux2014"," = glibc 2.17.",[57,248,249,252],{},[16,250,251],{},"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.",[13,254,255,256,259,260,263,264,266],{},"My server was ",[16,257,258],{},"CentOS 7 = glibc 2.17"," (confirmed with ",[21,261,262],{},"ldd --version","). And every onnxruntime release that ships a cp312 build has only ",[21,265,224],{}," wheels for Linux x86_64 — hence the failure.",[13,268,269],{},"It gets worse:",[271,272,273],"warning",{},[13,274,275,278,279],{},[16,276,277],{},"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. ",[16,280,281],{},"Downgrading can't save you either.",[13,283,284,285,288,289,292,293],{},"What about building from source? I checked the toolchain: ",[21,286,287],{},"gcc 4.8.5"," (from 2015), an empty ",[21,290,291],{},"\u002Fopt\u002Frh",", no devtoolset. pandas needs Cython + meson, and rapidfuzz needs C++17 — that old gcc can't build any of it. ",[16,294,295],{},"The source route was a dead end too.",[34,297,299],{"id":298},"_3-the-turning-point-this-isnt-a-technical-problem-its-a-product-problem","3. The turning point: this isn't a technical problem, it's a product problem",[13,301,302,303],{},"The technical layer was a dead end. At that moment, the most important call was: ",[16,304,305],{},"stop hammering on the dead end, step back one layer, and ask whether the constraint itself can be relaxed.",[13,307,308,309,312,313,316,317,320],{},"I went to find out who was pulling onnxruntime in. It turned out to be the project's image\u002Fdocument ",[16,310,311],{},"OCR feature"," (",[21,314,315],{},"rapidocr-onnxruntime"," \u002F ",[21,318,319],{},"rapidocr-paddle",", both of which sit on top of Microsoft's inference engine, onnxruntime).",[13,322,323,324,217,327],{},"So the question changed from \"how do I install onnxruntime on glibc 2.17\" into a ",[16,325,326],{},"product go\u002Fno-go decision",[16,328,329],{},"is this OCR feature still in use?",[13,331,332,333,336,337,339],{},"Once I confirmed it had been ",[16,334,335],{},"deprecated",", I commented out those two OCR packages in ",[21,338,103],{},", and onnxruntime dropped out of the entire dependency tree along with them. As far as onnxruntime was concerned, Python 3.12 was unblocked.",[341,342,343],"tip",{},[13,344,345,348],{},[16,346,347],{},"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\u002Fno-go is worth more than grinding through a dead end.",[34,350,352],{"id":351},"_4-the-second-wall-onnxruntime-wasnt-the-only-landmine","4. The second wall: onnxruntime wasn't the only landmine",[13,354,355,356,358,359,362,363,365,366,369],{},"After removing OCR, I ran ",[21,357,176],{}," again and hit ",[16,360,361],{},"faiss-cpu"," (it doesn't even publish an sdist, so it fails hard right away). I then scanned the whole ",[21,364,118],{}," against the target platform (cp312 \u002F glibc 2.17 \u002F x86_64) and found that recent versions of ",[16,367,368],{},"pandas \u002F greenlet \u002F rapidfuzz \u002F ujson"," were also missing glibc 2.17 wheels.",[13,371,372,373,376],{},"This time I didn't SSH in and firefight them one by one. Instead I ",[16,374,375],{},"encoded the platform constraint into the dependency declarations",", using two different kinds of tools:",[75,378,379,392],{},[78,380,381],{},[81,382,383,386,389],{},[84,384,385],{},"Package",[84,387,388],{},"Treatment",[84,390,391],{},"Why",[94,393,394,427,444,460,476],{},[81,395,396,405,412],{},[99,397,398,400,401,404],{},[21,399,361],{}," (pulled in via ",[21,402,403],{},"milvus-lite",")",[99,406,407,408,411],{},"Removed from the tree entirely via ",[21,409,410],{},"override-dependencies"," with an always-false marker",[99,413,414,415,418,419,422,423,426],{},"The chain is ",[21,416,417],{},"pymilvus → milvus-lite (local embedded mode) → faiss-cpu","; this project only connects to a ",[16,420,421],{},"remote"," Milvus and there is no ",[21,424,425],{},"import faiss"," anywhere in the repo, so this chain was never used",[81,428,429,434,441],{},[99,430,431],{},[21,432,433],{},"pandas",[99,435,436,437,440],{},"Pinned ",[21,438,439],{},"\u003C2.3"," → 2.2.3",[99,442,443],{},"2.2.x is the last line that publishes manylinux2014 wheels",[81,445,446,451,457],{},[99,447,448],{},[21,449,450],{},"greenlet",[99,452,436,453,456],{},[21,454,455],{},"\u003C3.2"," → 3.1.1",[99,458,459],{},"Required by SQLAlchemy; from 3.2 on, wheels are raised to glibc 2.24",[81,461,462,467,473],{},[99,463,464],{},[21,465,466],{},"rapidfuzz",[99,468,436,469,472],{},[21,470,471],{},"\u003C3.13"," → 3.12.2",[99,474,475],{},"Required by unstructured; from 3.13 on, raised to glibc 2.27",[81,477,478,483,489],{},[99,479,480],{},[21,481,482],{},"ujson",[99,484,436,485,488],{},[21,486,487],{},"\u003C5.11"," → 5.10.0",[99,490,491],{},"Required by pymilvus; newer versions are raised to glibc 2.24",[13,493,494,495,498],{},"The last four are pinned with ",[21,496,497],{},"constraint-dependencies",". There's a distinction here that often gets blurred:",[10,500,501],{},[205,502,503,523],{},[57,504,505,510,511,514,515,518,519,522],{},[16,506,507,509],{},[21,508,497],{}," (constraints)",": \"",[16,512,513],{},"if"," this package is used, its version must satisfy the constraint\". It will ",[16,516,517],{},"not"," pull in any package on its own; it only narrows the version range when an existing dependency is being resolved. ≈ using npm's ",[21,520,521],{},"overrides"," to \"narrow a version\".",[57,524,525,530,531,534,535,70],{},[16,526,527,529],{},[21,528,410],{}," (overrides)",": forcibly rewrites what someone else in the dependency tree declares about a package. Combined with an always-false marker (",[21,532,533],{},"sys_platform == 'never'",", which is true on no platform), it lets you ",[16,536,537],{},"cut out an entire unused chain",[13,539,540,541,543,544,547],{},"The result: ",[21,542,137],{}," ",[16,545,546],{},"finishes in seconds with zero C compilation"," — no Docker, no OS upgrade.",[10,549,550],{},[13,551,552,555,556,312,559,316,562,316,565,316,568,316,571,574,575,578,579,582],{},[16,553,554],{},"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 ",[16,557,558],{},"pure-Python sdists",[21,560,561],{},"oss2",[21,563,564],{},"aliyun-python-sdk-core",[21,566,567],{},"crcmod",[21,569,570],{},"memoization",[21,572,573],{},"langdetect","), which get a lightweight build on the spot but ",[16,576,577],{},"need no compiler",". The accurate claim is \"",[16,580,581],{},"zero C compilation","\", not \"pure wheels\". In technical writing, that kind of precision matters more than a pretty conclusion.",[34,584,586],{"id":585},"_5-why-uv-instead-of-sticking-with-pip","5. Why uv instead of sticking with pip",[13,588,589,590,593],{},"Getting the dependencies installed was just the outcome. I chose uv because it turns \"reproducible\" into an ",[16,591,592],{},"engineering capability you can put in a pipeline",":",[205,595,596,605,631],{},[57,597,598,601,602,604],{},[16,599,600],{},"Reproducible via lockfile",": any environment built from ",[21,603,118],{}," gets exactly the same dependency tree, which eliminates drift.",[57,606,607,612,613,616,617,619,620,623,624,626,627,630],{},[16,608,609,611],{},[21,610,137],{}," is idempotent",": it compares ",[21,614,615],{},".venv"," with ",[21,618,118],{},"; 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 ",[16,621,622],{},"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 ",[21,625,142],{}," to ",[21,628,629],{},"npm install",".)",[57,632,633,636,637,640,641,70],{},[16,634,635],{},"Configuration in one place",": the Python version constraint (",[21,638,639],{},"requires-python = \">=3.12,\u003C3.13\"","), the package index, and the platform constraints are all declared in a single ",[21,642,103],{},[13,644,645,646,649,650,653],{},"That last point leads directly to \"self-healing dependencies\": add ",[21,647,648],{},"uv sync --frozen --no-dev"," to the deployment pipeline, and from then on, when I change dependencies locally with ",[21,651,652],{},"uv add"," and commit the lockfile, the server catches up automatically at deploy time. No more SSHing in to install things by hand.",[34,655,657],{"id":656},"_6-going-live-a-gradual-cutover-a-classic-process-management-pitfall","6. Going live: a gradual cutover + a classic process-management pitfall",[13,659,660],{},"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).",[179,662,666],{"className":663,"code":664,"language":665,"meta":184,"style":184},"language-mermaid shiki shiki-themes github-light github-dark github-dark","flowchart LR\n    J[\"Jenkins: rsync source\"] --> S[\"uv sync --frozen (self-healing deps)\"]\n    S --> R[\"restart script: supervisorctl restart\"]\n    R --> P[\".venv\u002Fbin\u002Fpython entrypoint (uvicorn, multiple workers)\"]\n","mermaid",[21,667,668,673,678,684],{"__ignoreMap":184},[188,669,670],{"class":190,"line":191},[188,671,672],{},"flowchart LR\n",[188,674,675],{"class":190,"line":197},[188,676,677],{},"    J[\"Jenkins: rsync source\"] --> S[\"uv sync --frozen (self-healing deps)\"]\n",[188,679,681],{"class":190,"line":680},3,[188,682,683],{},"    S --> R[\"restart script: supervisorctl restart\"]\n",[188,685,687],{"class":190,"line":686},4,[188,688,689],{},"    R --> P[\".venv\u002Fbin\u002Fpython entrypoint (uvicorn, multiple workers)\"]\n",[13,691,692,695,696,543,698,701,702,705,706,316,709,712,713,626,715,717],{},[16,693,694],{},"Gradual cutover",": uv installs a standalone Python 3.12 in user space (without touching the system python), and the new ",[21,697,615],{},[16,699,700],{},"coexists"," with the old ",[21,703,704],{},"venv",". Switching over only requires pointing ",[21,707,708],{},"command",[21,710,711],{},"PATH"," in the supervisor config from ",[21,714,704],{},[21,716,615],{}," — an atomic, reversible action. Rollback = restoring the backed-up conf. It's close to a blue-green deployment.",[13,719,720,723,724,726,727,730],{},[16,721,722],{},"Then I walked into a classic pitfall",": after switching to ",[21,725,615],{}," and restarting, the service started flapping — ",[21,728,729],{},"status"," showed RUNNING for a moment, the pid kept changing, and it finally ended up FATAL. The investigation:",[205,732,733,739],{},[57,734,735,738],{},[21,736,737],{},"ss -ltnp"," filtered on the service port → a batch of old python processes were still holding that port;",[57,740,741,744,745,748,749,752,753,70],{},[21,742,743],{},"ps"," showed them with ",[21,746,747],{},"PPID=1"," and a cmdline of ",[21,750,751],{},"multiprocessing-fork"," → ",[16,754,755],{},"orphaned workers",[13,757,758,759,762,763,766,767,770],{},"Root cause: in uvicorn's multi-worker mode, the master spawns several workers, but ",[16,760,761],{},"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 → ",[21,764,765],{},"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 ",[21,768,769],{},"address already in use"," error, so for a while I couldn't even see it.)",[13,772,773,774,782,783,786,787,790,791,793],{},"The fix: add ",[16,775,776,44,779],{},[21,777,778],{},"stopasgroup=true",[21,780,781],{},"killasgroup=true"," to the supervisor conf so that it reaps the master and workers together as a ",[16,784,785],{},"process group",". For the one-off orphan cleanup, I used ",[21,788,789],{},"pkill -f"," with a pattern that matches exactly this app's ",[21,792,615],{}," path (to avoid hitting any other process).",[34,795,797],{"id":796},"_7-the-last-mile-the-test-and-production-machines-differ-too","7. The last mile: the test and production machines differ too",[13,799,800,801,804,805,808],{},"The test machine is CentOS 7 (glibc 2.17), but the production machine is ",[16,802,803],{},"Ubuntu 24.04 (glibc 2.39)",". glibc 2.39 is backward compatible with the manylinux2014 wheels pinned for 2.17, so production is actually ",[16,806,807],{},"easier to install on",". But the key discipline is this:",[810,811,812],"caution",{},[13,813,814,815,818,819,821,822,825,826],{},"Production ",[16,816,817],{},"must"," use ",[21,820,137],{},"; ",[16,823,824],{},"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. ",[16,827,828],{},"The value of a lockfile only truly shows when the two machines' environments differ like this.",[34,830,832],{"id":831},"_8-takeaways-and-honest-technical-debt","8. Takeaways and honest technical debt",[13,834,835],{},"A few reusable principles:",[54,837,838,844,850,856],{},[57,839,840,843],{},[16,841,842],{},"When a constraint has no solution at one layer, step back a layer"," (from technical to a product go\u002Fno-go).",[57,845,846,849],{},[16,847,848],{},"Encode platform constraints into the lockfile",", rather than relying on someone SSHing in to firefight by hand.",[57,851,852,855],{},[16,853,854],{},"Gradual rollout + atomic switch + easy rollback"," keep the blast radius of a release as small as possible.",[57,857,858,861],{},[16,859,860],{},"Lockfile-driven deployment = self-healing dependencies",": it removes the human-factor risk of \"don't forget to install the dependencies manually\" from the process.",[13,863,864,865,868,869,872],{},"The technical debt left behind deserves an honest record too: pinning 4 packages to old versions is ",[16,866,867],{},"accommodating an end-of-life CentOS 7 box",". The clean long-term answer is containerization (the ",[21,870,871],{},"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.",[10,874,875],{},[13,876,877,880,881,316,884,316,887,890,891,894],{},[16,878,879],{},"A closing note (from an AI engineering perspective)",": AI projects are inherently heavier on dependencies — ML-native packages like ",[21,882,883],{},"torch",[21,885,886],{},"onnxruntime",[21,888,889],{},"faiss"," are extremely sensitive to glibc, CUDA, and the build toolchain. So in AI engineering, \"",[16,892,893],{},"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.",[896,897,898],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":184,"searchDepth":197,"depth":197,"links":900},[901,902,903,904,905,906,907,908],{"id":36,"depth":197,"text":37},{"id":169,"depth":197,"text":170},{"id":298,"depth":197,"text":299},{"id":351,"depth":197,"text":352},{"id":585,"depth":197,"text":586},{"id":656,"depth":197,"text":657},{"id":796,"depth":197,"text":797},{"id":831,"depth":197,"text":832},"2026-06-09","A Python 3.12 upgrade plus a pip-to-uv migration that should have taken ten minutes turned into a deep dive on wheel, manylinux and glibc ABI compatibility on an end-of-life CentOS 7 (glibc 2.17) server, and showed how uv makes dependency management reproducible and self-healing.","md",null,"\u002Farticles\u002Fpython-312-uv-glibc.svg",{},true,"\u002Farticles\u002Fpython-312-uv-glibc",4.5,"9",{"title":5,"description":910},{"loc":916},"articles\u002Fpython-312-uv-glibc",[923,924,925],"Backend","DevOps","Debugging","fVXu98lxcAHScmMAHW6pQEre5He0trca3JumIei-Kio",1795761652208]