-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Expected Behavior
I expected that while installing the poetry package manager, the poetry install process would find all Python shared libraries.
Actual Behavior
Instead the error 1.119 /home/.local/share/pypoetry/venv/bin/python3: error while loading shared libraries: libpython3.10.so.1.0: cannot open shared object file: No such file or directory
is shown.
This install process worked in the function runtime v3 images, and seems to be caused by ld.so.cache
being out of date. A work-around for the issue is running ldconfig
.
Steps to Reproduce
I'm going to provide four example Dockerfiles.
The first Dockerfile demonstrates that one can install Poetry in this manner using a v3 runtime, and Python 3.9.
The second Dockerfile demonstrates that this does not work in a v4 runtime, again using Python 3.9.
The third Dockerfile demonstrates a work-around: if you run ldconfig
before installing poetry, it works again.
The fourth Dockerfile demonstrates that bug can occur in v4 using Python 3.10, in order to demonstrate the bug with a supported version of the runtime and a supported version of Python.
Relevant code being tried
# This works in v3
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.9
RUN curl -sSL https://install.python-poetry.org | python3 -; \
saved=$?; \
cat /poetry-*.log; \
exit $saved
# This fails in v4, only changing runtime version
FROM mcr.microsoft.com/azure-functions/python:4-python3.9
RUN curl -sSL https://install.python-poetry.org | python3 -; \
saved=$?; \
cat /poetry-*.log; \
exit $saved
# This works in v4, using ldconfig workaround
FROM mcr.microsoft.com/azure-functions/python:4-python3.9
RUN ldconfig
RUN curl -sSL https://install.python-poetry.org | python3 -; \
saved=$?; \
cat /poetry-*.log; \
exit $saved
# This fails, while using a supported version of Python
FROM mcr.microsoft.com/azure-functions/python:4-python3.10
RUN curl -sSL https://install.python-poetry.org | python3 -; \
saved=$?; \
cat /poetry-*.log; \
exit $saved
Relevant log output
This corresponds to the Dockerfile labelled # This works in v3
Sending build context to Docker daemon 13MB
Step 1/2 : FROM mcr.microsoft.com/azure-functions/python:3.0-python3.9
---> 414c8b656d7d
Step 2/2 : RUN curl -sSL https://install.python-poetry.org | python3 -; saved=$?; cat /poetry-*.log; exit $saved
---> Running in 4e66901f724c
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
/home/.local/bin
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (2.1.3)
Installing Poetry (2.1.3): Creating environment
Installing Poetry (2.1.3): Installing Poetry
Installing Poetry (2.1.3): Creating script
Installing Poetry (2.1.3): Done
Poetry (2.1.3) is installed now. Great!
To get started you need Poetry's bin directory (/home/.local/bin) in your `PATH`
environment variable.
Add `export PATH="/home/.local/bin:$PATH"` to your shell configuration file.
Alternatively, you can call Poetry explicitly with `/home/.local/bin/poetry`.
You can test that everything is set up by executing:
`poetry --version`
cat: '/poetry-*.log': No such file or directory
---> Removed intermediate container 4e66901f724c
---> 6f890f3bf05e
Successfully built 6f890f3bf05e
Successfully tagged reprex:latest
This corresponds to the Dockerfile labelled # This fails in v4, only changing runtime version
Sending build context to Docker daemon 13MB
Step 1/2 : FROM mcr.microsoft.com/azure-functions/python:4-python3.9
---> aa17fc245253
Step 2/2 : RUN curl -sSL https://install.python-poetry.org | python3 -; saved=$?; cat /poetry-*.log; exit $saved
---> Running in 25b6c75f7fe7
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
/home/.local/bin
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (2.1.3)
Installing Poetry (2.1.3): Creating environment
Installing Poetry (2.1.3): An error occurred. Removing partial environment.
Poetry installation failed.
See /poetry-installer-error-twmuhwt6.log for error logs.
/home/.local/share/pypoetry/venv/bin/python3: error while loading shared libraries: libpython3.9.so.1.0: cannot open shared object file: No such file or directory
Traceback:
File "<stdin>", line 937, in main
File "<stdin>", line 576, in run
The command '/bin/sh -c curl -sSL https://install.python-poetry.org | python3 -; saved=$?; cat /poetry-*.log; exit $saved' returned a non-zero code: 127
This corresponds to the Dockerfile labelled # This works in v4, using ldconfig workaround
.
Sending build context to Docker daemon 13MB
Step 1/3 : FROM mcr.microsoft.com/azure-functions/python:4-python3.9
---> aa17fc245253
Step 2/3 : RUN ldconfig
---> Running in 4e4897eba9b8
---> Removed intermediate container 4e4897eba9b8
---> 7f252faa3c92
Step 3/3 : RUN curl -sSL https://install.python-poetry.org | python3 -; saved=$?; cat /poetry-*.log; exit $saved
---> Running in c8e50746fb94
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
/home/.local/bin
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (2.1.3)
Installing Poetry (2.1.3): Creating environment
Installing Poetry (2.1.3): Installing Poetry
Installing Poetry (2.1.3): Creating script
Installing Poetry (2.1.3): Done
Poetry (2.1.3) is installed now. Great!
To get started you need Poetry's bin directory (/home/.local/bin) in your `PATH`
environment variable.
Add `export PATH="/home/.local/bin:$PATH"` to your shell configuration file.
Alternatively, you can call Poetry explicitly with `/home/.local/bin/poetry`.
You can test that everything is set up by executing:
`poetry --version`
cat: '/poetry-*.log': No such file or directory
---> Removed intermediate container c8e50746fb94
---> 3e21ffb4af08
Successfully built 3e21ffb4af08
Successfully tagged reprex:latest
This corresponds to the Dockerfile labelled # This fails, while using a supported version of Python
Sending build context to Docker daemon 13MB
Step 1/2 : FROM mcr.microsoft.com/azure-functions/python:4-python3.10
---> 32712b6e2a5f
Step 2/2 : RUN curl -sSL https://install.python-poetry.org | python3 -; saved=$?; cat /poetry-*.log; exit $saved
---> Running in dea2f8530ac0
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
/home/.local/bin
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (2.1.3)
Installing Poetry (2.1.3): Creating environment
Installing Poetry (2.1.3): An error occurred. Removing partial environment.
Poetry installation failed.
See /poetry-installer-error-9hlz8jrz.log for error logs.
/home/.local/share/pypoetry/venv/bin/python3: error while loading shared libraries: libpython3.10.so.1.0: cannot open shared object file: No such file or directory
Traceback:
File "<stdin>", line 937, in main
File "<stdin>", line 576, in run
The command '/bin/sh -c curl -sSL https://install.python-poetry.org | python3 -; saved=$?; cat /poetry-*.log; exit $saved' returned a non-zero code: 127
requirements.txt file
N/A - issue occurs prior to installing packages
Where are you facing this problem?
Local - Core Tools
Function app name
No response
Additional Information
I suggest that ldconfig
be run in the base image so that others who want to install Poetry can do so without encountering this error.