[Python] The underlying compression routine could not be loaded correctly error when deplying...

Discussão em 'Python' iniciado por Stack, Abril 23, 2025.

  1. Stack

    Stack Membro Participativo

    Tried running in vs code this command:

    func azure functionapp publish [the function app name]


    got this output:


    Getting site publishing info...
    [2025-04-23T12:26:20.365Z] Starting the function app deployment...
    Creating archive for current directory...
    Performing remote build for functions project.
    Deleting the old .python_packages directory
    The underlying compression routine could not be loaded correctly.
    ​

    Validations

    • Using powershell, the ls command, I validated that I was running the actual function app project I want to deploy. This is the file/folder structure for the project:

    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    d----- 4/22/2025 9:56 PM .vscode
    -a---- 4/21/2025 11:12 AM 517 .gitignore
    -a---- 4/21/2025 10:06 PM 391 additional_functions.py
    -a---- 4/22/2025 10:11 PM 560 function_app.py
    -a---- 4/21/2025 11:12 AM 302 host.json
    -a---- 4/22/2025 6:13 PM 206 local.settings.json
    -a---- 4/22/2025 9:39 PM 207 requirements.txt

    • Checked host.json properties, see them below:

    {
    "version": "2.0",
    "logging": {
    "applicationInsights": {
    "samplingSettings": {
    "isEnabled": true,
    "excludedTypes": "Request"
    }
    }
    },
    "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
    }
    }

    • Checked local.settings.json properties, see them below:

    {
    "IsEncrypted": false,
    "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsFeatureFlags": "enableWorkerIndexing",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
    }
    }

    • requirements.txt has the following module:

    azure-functions


    • Both the function app in Azure and the local project are running on Python 3.10.


    • Checked the environment variables in azure for the function app, they are the following:
    Environment Variables
    APPLICATIONINSIGHTS_CONNECTION_STRING
    AzureWebJobsFeatureFlags
    AzureWebJobsStorage
    FUNCTIONS_EXTENSION_VERSION
    FUNCTIONS_WORKER_RUNTIME
    • I have the latest az cli version installed:

    az --version
    azure-cli 2.71.0
    core 2.71.0
    telemetry 1.1.0
    Dependencies:
    msal 1.31.2b1
    azure-mgmt-resource 23.1.1


    • Checked Azure Core Tools version, it's 4.0.7030.


    • Made sure I was logged in before, running az login.

    Continue reading...

Compartilhe esta Página