Skip to content

Python run fails because the installation does not have required system dependencies #70

@kishaningithub

Description

@kishaningithub

Python 3.12 installed via pkgx does not work within docker. Python run fails with message

python: error while loading shared libraries: libpython3.12.so.1.0: cannot open shared object file: No such file or directory

Simulation steps

  • Create a docker file named trial.Dockerfile with the following contents
FROM pkgxdev/pkgx

RUN pkgm install python@3.12

RUN python -c 'print("hello world")'
  • Run command docker build -f trial.Dockerfile -t trial:latest .

Expected behaviour

Docker build must be successful and "hello world" must be printed

Actual behaviour

Errors out with message python: error while loading shared libraries: libpython3.12.so.1.0: cannot open shared object file: No such file or directory

Full log

[+] Building 1.2s (6/6) FINISHED                                                                                                               docker:colima
 => [internal] load build definition from trial.Dockerfile                                                                                              0.0s
 => => transferring dockerfile: 128B                                                                                                                    0.0s
 => [internal] load metadata for docker.io/pkgxdev/pkgx:latest                                                                                          0.9s
 => [internal] load .dockerignore                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                         0.0s
 => [1/3] FROM docker.io/pkgxdev/pkgx:latest@sha256:3cb64e57aede0ce66da3e5be729d7f72d46119a1583aa69e69b60e7d419d58b2                                    0.0s
 => CACHED [2/3] RUN pkgm install python@3.12                                                                                                           0.0s
 => ERROR [3/3] RUN python -c 'print("hello world")'                                                                                                    0.2s
------                                                                                                                                                       
 > [3/3] RUN python -c 'print("hello world")':
0.158 python: error while loading shared libraries: libpython3.12.so.1.0: cannot open shared object file: No such file or directory
------
trial.Dockerfile:5
--------------------
   3 |     RUN pkgm install python@3.12
   4 |     
   5 | >>> RUN python -c 'print("hello world")'
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c python -c 'print(\"hello world\")'" did not complete successfully: exit code: 127

Possible fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions