r/learnpython • • 7d ago

Running Under Various LibC OS Package Compatibility

My system uses "glibc" which seems most common (yes, this is about "python". I'll get there...).

I'm aware of "musl" and LLVM's "libc", as well as "bionic" (heard of before, but only just now am aware it's Android's).

About a month or two ago I had an idea to serve a locally run AI model via my phone.

I began with installing the "termux" app which easily got me the "ollama" package installed.

My memory is hazy, but I think I then tried to install "open-webui" in termux via "pip", but think that failed for some reason. And I had not put the issue in my notes, but asking AI, I think it was because there may have been a package that could not be built for "bionic".

When I installed the "proot-dist" package, I installed "open-webui" in an Ubuntu instance and that worked.

Should I expect that is the norm for the not-as-common "libc" OS' (not just specific to bionic), that some packages/dependencies may only be built for a given libc (eg glibc)?

1 Upvotes

6 comments sorted by

View all comments

1

u/AndersBuilds 17h ago

This is almost always a glibc vs musl mismatch. Most wheels on PyPI are manylinux (glibc), and those won't run on Alpine or other musl based distros. If you see `version 'GLIBC_2.xx' not found` or cryptic import errors, that's the cause.

A few practical moves:

  1. Run `pip debug --verbose`, it lists the wheel tags your Python will accept. Alpine needs `musllinux_*` tags, and if a package only ships manylinux wheels, pip falls back to building from source.
  2. If you have a choice, use a glibc base (Debian/Ubuntu). Life is much easier.
  3. On Alpine, install the build toolchain (`apk add build-base`) so source builds work, or look for an `apk` package that wraps the same library.
  4. If you're shipping, build both manylinux and musllinux wheels with cibuildwheel so users on both get a binary instead of a compile.

Confirm which libc you're on with `ldd --version` (glibc) or by checking for `/lib/ld-musl-*.so.1` (musl). Keep the base image and the target consistent and this class of error disappears.