Python 3.11 Function Apps may fail to load with  No module named 'pkg_resources'

Aperta
#1,928 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
azure, python
Ambito
backend

Direzione di ricerca

Start by checking the Python 3.11 worker startup and function indexing behavior described in the issue, then look for where the worker image or dependency environment supplies setuptools. The issue identifies a mitigation in requirements.txt and the setuptools version change from 65.5.1 to 84.2.1. Done means affected apps can load functions when pkg_resources is imported; the issue does not name a test or code entry point.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

announcement

Description

Some Python 3.11 Azure Function Apps may fail to load their functions after receiving an updated platform image. Logs show:

ModuleNotFoundError: No module named 'pkg_resources'

The Functions host may start, but function indexing fails, leaving affected functions unavailable. This can occur without changes to application code or dependencies.

Apps are affected when their code—or an installed dependency—imports  pkg_resources  and relies on the platform image to provide it.

Cause

The updated Python 3.11 image upgraded setuptools from 65.5.1 to 84.2.1. Setuptools removed the deprecated  pkg_resources  module starting with 82.0.0.

Applications that do not explicitly install a compatible setuptools version can therefore lose access to  pkg_resources  when the underlying image updates.

Mitigation

Add the following dependency to your app’s  requirements.txt , replacing any existing setuptools requirement, and redeploy:

setuptools>=78.1.1,<82

This installs an application-local version of setuptools that still includes  pkg_resources , rather than relying on the platform image’s copy. Restarting the app alone does not install this dependency.

For a long-term solution, update affected dependencies or migrate to supported alternatives such as  importlib.metadata  and  importlib.resources .

Lingua principale
Python
Stelle
357
Fork
118
Merge medio
2g 6h
PR unite (30g)
10

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/azure-functions-python-worker

Tutte le issue di Azure/azure-functions-python-worker

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.