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

オープン
#1,928 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
azure, python
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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 .

主要言語
Python
スター
357
フォーク
118
平均マージ
2日 6時間
マージ済み PR(30日)
10

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Azure/azure-functions-python-worker のほかの issue

Azure/azure-functions-python-worker の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。