Upgrading GLIBC in Azure Web App

Peter 0 Reputation points
2025-02-28T16:18:24.2966667+00:00

I'm running a Web App with Python 3.12, but it fails after deployment due to upgraded packages, specifically cryptography and bcrypt. The error is:


from ._bcrypt import (

ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/site/wwwroot/antenv/lib/python3.12/site-packages/bcrypt/_bcrypt.abi3.so)

Pinning the packages in requirements.txt works temporarily, but it's not a long-term solution as it leads to outdated packages. With pinned packages, the app runs fine, and the current glibc version is 2.31. Is there a way to upgrade to glibc 2.34, or does the Azure team need to provide an updated image/container?

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

1 answer

Sort by: Most helpful
  1. Andriy Bilous 11,646 Reputation points MVP
    2025-02-28T20:26:14.16+00:00

    Hello

    If pinning the packages in requirements.txt is not an option for you I would recommend you to deploy your app in a WebApp containerized environment.
    You can create a custom Docker image with the required glibc version. Start with a base image that includes glibc 2.34 or higher, or manually upgrade it within the Dockerfile.

    You could use it to upgrade glibc to version 2.34 or higher.

    Here’s a Dockerfile:

    # Use a base image with Python 3.12
    FROM python:3.12-slim
    
    # Install prerequisites for building glibc
    RUN apt-get update && apt-get install -y \
        build-essential \
        manpages-dev \
        wget
    
    # Download and compile glibc
    RUN wget http://ftp.gnu.org/gnu/libc/glibc-2.34.tar.gz && \
        tar -xvzf glibc-2.34.tar.gz && \
        cd glibc-2.34 && \
        mkdir build && cd build && \
        ../configure --prefix=/opt/glibc-2.34 && \
        make -j$(nproc) && \
        make install && \
        cd ../../ && rm
    
    0 comments No comments

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.