python function app works locally but not when deployed,

B K 41 Reputation points
2020-11-24T20:09:53.277+00:00

I run my function locally with vscode and it works fine. when i deploy it, i get the following error:

Result: Failure Exception: ImportError: libpq.so.5: cannot open shared object file: No such file or directory. Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 271, in _handle__function_load_request func = loader.load_function( File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 34, in call raise extend_exception_message(e, message) File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 32, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/loader.py", line 76, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/site/wwwroot/wsmtimer/init.py", line 16, in <module> import psycopg2 File "/home/site/wwwroot/.python_packages/lib/site-packages/psycopg2/init.py", line 51, in <module> from psycopg2._psycopg import ( # noqa

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,189 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 67,991 Reputation points
    2020-11-25T02:59:02.56+00:00

    Hi @B K

    Can you please confirm if you are using psycopg2-binary instead of psycopg2 in your requirement.txt file?


0 additional answers

Sort by: Most helpful