Skip to content

Need --enabled-shared (aka python-dev) for Python feature #746

@davetapley

Description

@davetapley

AFAICT no way to --enable-shared for Python feature.

I ran into this with:

    "image": "mcr.microsoft.com/devcontainers/universal:2",
    "features": {
        "ghcr.io/devcontainers/features/python:1": {
            "version": "3.11.4"
        },

And tried to use pyinstaller, but fails with:

OSError: Python library not found: libpython3.11m.so.1.0, libpython3.11.so.1.0, libpython3.11.so, libpython3.11mu.so.1.0, libpython3.11m.so
    This means your Python installation does not come with proper shared library files.
    This usually happens due to missing development package, or unsuitable build parameters of the Python installation.

    * On Debian/Ubuntu, you need to install Python development packages:
      * apt-get install python3-dev
      * apt-get install python-dev
    * If you are building Python by yourself, rebuild with `--enable-shared` (or, `--enable-framework` on macOS).

Somewhat confusingly apt-get install gives:

python3-dev is already the newest version (3.8.2-0ubuntu2).

But I'm guessing that's no use because ghcr.io/devcontainers/features/python has built / installed its own Python, and that's what pyinstaller is using.

Other option is --enable-shared, but I'm not sure how to do that since the Python feature handles building Python.


Note that if requested version is available in Oryx then I think you get --enable-shared by default because this, so perhaps is should be on by default when building from source too?

Otherwise, for example, a Python could be added to Oryx and now suddenly you'd get --enabled-shared behavior when you previously didn't. I don't know if Oryx prunes older versions, but I can also envisage it suddenly not being --enable-shared if that does happen.

Activity

davetapley

davetapley commented on Nov 8, 2023

@davetapley
Author

Got close here https://github.com/JEFuller/features/commit/92c72dee3c8beb611f6a28cf33f2a0e4dd1010dc,
But get stuck with error while loading shared libraries: ... when trying python 😞

Hoped LD_RUN_PATH="${INSTALL_PATH}/lib" before ./configure would resolve per here. But no.

samruddhikhandale

samruddhikhandale commented on Nov 10, 2023

@samruddhikhandale
Member

Hi 👋

Can you try with the following dev container?

{
	"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
	"features": {
		"ghcr.io/devcontainers/features/python:1": {
			"version": "3.11.4"
		}
	}
}

To me, it looks like enabled-shared is configured, and I was able to install pyinstaller. See 👇

Image

The universal image already installs two versions of Python versions, and it does not use Oryx (for python installation) which might explain why the enbaled shared is missing (I wonder if there's some conflict). See https://github.com/devcontainers/images/blob/main/src/universal/.devcontainer/devcontainer.json#L25-L31

Feel free to let me know if I have misunderstood your question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Need --enabled-shared (aka python-dev) for Python feature · Issue #746 · devcontainers/features