indygreg / python-build-standalone

Produce redistributable builds of Python
Mozilla Public License 2.0
1.97k stars 125 forks source link

python3 -mvenv --upgrade-deps fails #218

Closed dsp closed 7 months ago

dsp commented 7 months ago

When using a musl standalone build, python3 -m venv --upgrade-deps .venv fails due to "OSError: Dynamic loading not supported". This is one of the issues currently stopping rye from running on a musl only build. I tested this on both Ubuntu and Alpine.

This fails because venv will pull pip from ensurepip/_bundled and not the patched pip that is in site-packages. So the underlying issue is similar to #30.

I looked into Alpine's python and it's a dynamically linked python for which dlopen works.

indygreg commented 7 months ago

The statically linked musl builds are extremely limited in utility because of the lack of dynamic library loading support (https://gregoryszorc.com/docs/python-build-standalone/20240107/quirks.html#static-linking-of-musl-libc-prevents-extension-module-library-loading).

Long on the project backlog is #86, which likely entails building a dynamic musl libc and having separate CPython distributions that link against that. Those would likely be compatible with Alpine and PEP 656 platform tag for musl, which assumes existing of a dynamic musl library.

If PEP 656 had been around when I created this project, I may have just made musl libc dynamic by default.

Perhaps we should close this as a duplicate of #86?

dsp commented 7 months ago

The statically linked musl builds are extremely limited in utility because of the lack of dynamic library loading support (https://gregoryszorc.com/docs/python-build-standalone/20240107/quirks.html#static-linking-of-musl-libc-prevents-extension-module-library-loading).

Long on the project backlog is #86, which likely entails building a dynamic musl libc and having separate CPython distributions that link against that. Those would likely be compatible with Alpine and PEP 656 platform tag for musl, which assumes existing of a dynamic musl library.

If PEP 656 had been around when I created this project, I may have just made musl libc dynamic by default.

Perhaps we should close this as a duplicate of #86?

Sounds good. Thanks for the overview. I'll close it for now.