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

Đang mở
#1,928 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
azure, python
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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 .

Ngôn ngữ chính
Python
Star
357
Fork
118
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Azure/azure-functions-python-worker

Tất cả issue của Azure/azure-functions-python-worker

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.