how to install linux package in azure app service?

Eric Huang 60 Reputation points Microsoft Employee
2023-08-26T18:02:34.14+00:00

I had deploy a python project to azure app service, when I browse the app service, I get the below error message:

mportError: libgomp.so.1: cannot open shared object file: No such file or directory

Please reference the screenshot for more detail error log.

If in Ubuntu, I can use sudo apt-get.... to install every package which I need.

But how can I do in Azure app service?

I try https://github.com/Azure/azure-functions-python-worker/issues/497#issuecomment-540830721

Add scripts before import in app.py, but it is not working.

Great appreciate any suggestion, thanks again!

User's image

User's image

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
0 comments No comments
{count} votes

Accepted answer
  1. Konstantinos Passadis 19,586 Reputation points MVP
    2023-08-26T18:08:17.6+00:00

    Hello @Eric Huang !

    Welcome to Microsoft QnA!

    Your deployment appears to have a Dependency that requires the libgomp shared library, which is not present in the Azure App Service environment.

    Look at the Docker solution !

    https://learn.microsoft.com/en-us/training/modules/deploy-run-container-app-service/

    • Start with a base image that has Python installed.
    • Install the necessary system dependencies using apt-get or any other method.
    • Add your Python code and necessary Python packages.
    • Push the Docker image to a container registry (like Docker Hub or Azure Container Registry).
    • In the Azure App Service, choose to deploy your application using a custom Docker container and point it to your Docker image.

    OR :

    1. Oryx Build: Azure App Service uses Oryx for building and running applications. There's an option to provide custom build scripts, which can sometimes be used to set up specific settings or binaries.

    https://github.com/microsoft/Oryx


    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2023-08-30T11:21:01.39+00:00

    @Eric Huang

    This will happen when a python dependency you are using requires a library not installed on app services python images.

    The workaround for this would be to create an app service startup script to install these libraries.

    See this blog post for details

    Please let us know if further query or issue remains.

    1 person found this answer helpful.
    0 comments No comments

  2. Glöckner, Sven 5 Reputation points
    2024-03-06T10:48:39.5233333+00:00

    You can easily add a startup script (bash) to run any command that installs your libraries. At the end of the script make sure you add the correct command that starts your application.

    Example for a startup script named run.sh for .NET Core

    #!/bin/bash
    apt-get update &&
    apt-get install -y apt-utils &&
    printf 'debconf debconf/frontend select Noninteractive\n' | debconf-set-selections &&
    apt-get install -y software-properties-common &&
    add-apt-repository 'deb http://deb.debian.org/debian bullseye main' && apt-get update &&
    apt-get install -y libc6 -f -o APT::Immediate-Configure=0 &&
    apt-get install -y libgdiplus libicu-dev libharfbuzz0b libfontconfig1 libfreetype6 libpango-1.0-0 libpangocairo-1.0 &&
    dotnet <YourApplicationNameHere>.dll 
    
    

    (Taken from https://supportcenter.devexpress.com/ticket/details/t1055122/how-to-configure-and-publish-reporting-app-in-azure-app-service-linux)

    In the App Service make sure you configure the startup command accordingly.

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.