Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.29k stars 429 forks source link

Provide a way to amend PATH and/or LD_LIBRARY_PATH when publishing to linux apps. #1620

Open ahmelsayed opened 4 years ago

ahmelsayed commented 4 years ago

Context: #1358

mlazowik commented 4 years ago

Related: Azure/azure-functions-python-worker#560

mlazowik commented 4 years ago

Currently you can't set PATH in Application settings at all.

Zrzut ekranu 2019-10-31 o 20 58 16

horihiro commented 4 years ago

I cannot find ld in container image mcr.microsoft.com/azure-functions/python as mlazowik pointed out in Azure/azure-functions-python-worker#560 .

$ docker run --rm -it  mcr.microsoft.com/azure-functions/python sh -c "which ld"

$

Do you have a plan to add ld to the container image?

Best Regards,

YaroslavKormushyn commented 2 years ago

Even after adding the "fix" in https://github.com/Azure/azure-functions-docker/pull/170, I still can't see the runtime using LD_LIBRARY_PATH to resolve libraries. I'm using Python 3.9 on Linux Consumption Plan. I have a couple of wheels, which are converted from conda packages, and they have their .so dependencies unpacked to .python_packages/lib/site-packages/lib where they don't seem to be picked up when importing. I've set the LD_LIBRARY_PATH to /home/site/wwwroot/.python_packages/lib/site-packages/lib and receive a ImportError: libTKBRep.so.7: cannot open shared object file: No such file or directory. I can confirm that using os.listdir('/home/site/wwwroot/.python_packages/lib/site-packages/lib') actually returns the libTKBRep.so.7 in question. The exact same build on Ubuntu 20.04 locally actually uses the env variable and works if it's set (respectively doesn't work if it's NOT set).

What could be the issue? Does the runtime actually use the LD_LIBRARY_PATH set in application settings?

damienwebdev commented 11 months ago

I am also seeing this while trying to use OracleDB with Azure Function apps (v4 w/ Node 18).

To use the Oracle Node library, I have to configure:

LD_LIBRARY_PATH="/home/site/wwwroot/oracle-instant-client/"

However, after doing so with app settings:

image

and confirming that the env variable is loaded correctly and then checking the file system to see that the files are there, I'm still getting:

Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: \"libclntsh.so: cannot open shared object file: No such file or directory\". See https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html for help",
          "Node-oracledb installation instructions: https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html",
          "You must have Linux 64-bit Oracle Client libraries configured with ldconfig, or in LD_LIBRARY_PATH."

I can confirm that the libclntsh.so is at the specified LD_LIBRARY_PATH path. I can even confirm that the app works successfully when using func start locally.

danjrwalsh commented 2 weeks ago

Even after adding the "fix" in Azure/azure-functions-docker#170, I still can't see the runtime using LD_LIBRARY_PATH to resolve libraries. I'm using Python 3.9 on Linux Consumption Plan. I have a couple of wheels, which are converted from conda packages, and they have their .so dependencies unpacked to .python_packages/lib/site-packages/lib where they don't seem to be picked up when importing. I've set the LD_LIBRARY_PATH to /home/site/wwwroot/.python_packages/lib/site-packages/lib and receive a ImportError: libTKBRep.so.7: cannot open shared object file: No such file or directory. I can confirm that using os.listdir('/home/site/wwwroot/.python_packages/lib/site-packages/lib') actually returns the libTKBRep.so.7 in question. The exact same build on Ubuntu 20.04 locally actually uses the env variable and works if it's set (respectively doesn't work if it's NOT set).

What could be the issue? Does the runtime actually use the LD_LIBRARY_PATH set in application settings?

After over 2 years since your initial comment (and nearly 5 years since this issue was opened) it's still not possible to append to PATH and LD_LIBRARY_PATH still appears to be completely ignored by the Azure function runtime. 😞