[Bug] `ld.so.cache` is out of date, leading to `libpython3.10.so.1.0: cannot open shared object file` error
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- azure, docker, python
- Domain
- cloud, infrastructure
Research direction
Start by locating the Azure Functions Python v3 and v4 base-image build definitions and reproduce the four Dockerfile cases described in the issue, including the ldconfig workaround. Compare how the shared-library cache is generated; done means the supported Python images allow the Poetry installer to find libpython3.9.so.1.0 and libpython3.10.so.1.0 without a manual workaround.
Written by the indexing model from the issue text.
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.
- Dominant language
- Python
- Stars
- 357
- Forks
- 116
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/azure-functions-python-worker
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug python
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Azure/azure-functions-python-worker#1881 · 2 comments · 3 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
Azure/azure-functions-python-worker#1908 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Azure/azure-functions-python-worker#1906 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
All issues in Azure/azure-functions-python-worker
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
use-agent-os/agent-os#3314 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AiursoftWeb/AnduinOS-2#19 ·