Python 3.14 runtime image omits _zstd, so compression.zstd cannot import
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- docker, python
- 领域
- build-system, devops
调研方向
首先,针对 mcr.microsoft.com/azure-functions/python:4-python3.14 运行提供的两个 Docker 命令,并确认导入失败以及 MODULE__ZSTD_STATE 的值。然后跟踪该镜像的 Python 构建和依赖配置,找出 Zstandard 开发依赖项的选择位置。当重建后的官方镜像能够成功导入 compression.zstd,并报告 _zstd 模块存在时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Expected Behavior
The official Python 3.14 Azure Functions runtime should include CPython's _zstd extension so that the Python 3.14 standard-library import from compression import zstd succeeds. Python 3.14 is GA for Azure Functions, and CPython documents Zstandard 1.4.5 or later as the build dependency for this optional standard-library module.
Actual Behavior
In the official mcr.microsoft.com/azure-functions/python:4-python3.14 image, importing compression.zstd raises ModuleNotFoundError: No module named '_zstd'. CPython's recorded build state reports MODULE__ZSTD_STATE=missing. The final image contains libzstd.so.1, but the extension was not compiled when CPython was built, so adding the runtime library or installing the third-party zstandard package cannot restore the missing standard-library extension.
Steps to Reproduce
-
Pull the current official image:
docker pull --platform linux/amd64 mcr.microsoft.com/azure-functions/python:4-python3.14 -
Run the standard-library import:
docker run --platform linux/amd64 --rm mcr.microsoft.com/azure-functions/python:4-python3.14 python -c "from compression import zstd" -
Inspect CPython's recorded module build state:
docker run --platform linux/amd64 --rm mcr.microsoft.com/azure-functions/python:4-python3.14 python -c "import sysconfig; print(sysconfig.get_config_var('MODULE__ZSTD_STATE'))" -
Observe the import failure and the
missingbuild state.
Relevant code being tried
docker run --platform linux/amd64 --rm mcr.microsoft.com/azure-functions/python:4-python3.14 python -c "from compression import zstd"
docker run --platform linux/amd64 --rm mcr.microsoft.com/azure-functions/python:4-python3.14 python -c "import sysconfig; print(sysconfig.get_config_var('MODULE__ZSTD_STATE'))"
Relevant log output
Python 3.14.4
Traceback (most recent call last):
File "<string>", line 1, in <module>
from compression import zstd
File "/opt/python/3/lib/python3.14/compression/zstd/__init__.py", line 29, in <module>
import _zstd
ModuleNotFoundError: No module named '_zstd'
MODULE__ZSTD_STATE: missing
Installed runtime library:
libzstd1:amd64 1.5.5+dfsg2-2build1.1
libzstd.so.1
requirements.txt file
No third-party requirements are needed. The failure reproduces directly in the unmodified Azure Functions base image.
Where are you facing this problem?
Production Environment (explain below)
Function app name
No response
Additional Information
Image tested: mcr.microsoft.com/azure-functions/python:4-python3.14
Image digest at the time of testing:
sha256:2504f2b6dff243d671183e9dd6d607d1ae8f35e3536aa14965ffc3516749c1b8
CPython build requirements document Zstandard >= 1.4.5 for compression.zstd:
https://docs.python.org/3.14/using/configure.html#requirements-for-optional-modules
Impact: libraries may select the Python 3.14 standard-library Zstandard implementation based on the interpreter version. For example, starlette-compress uses compression.zstd on Python >= 3.14, so its default Zstandard support fails under this image even though it works with Python distributions that include _zstd. Installing the third-party zstandard package does not fix that import path.
Current application workaround: probe importlib.util.find_spec("_zstd") and disable Zstandard, falling back to Brotli or Gzip. The durable fix is to make the Zstandard development dependency available when CPython is compiled for the official Python 3.14 Functions runtime.
- 主要语言
- Python
- 星标
- 357
- 派生
- 117
- 平均合并
- 9 天 27 分钟
- 30 天内合并 PR
- 3
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure/azure-functions-python-worker 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 5/5 一周以上 新手友好度 28/100
Azure/azure-functions-python-worker#1908 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 55/100
Azure/azure-functions-python-worker#1906 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 55/100
查看 Azure/azure-functions-python-worker 的全部 Issue
相似的 Issue
-
docs pydanty:is-working
难度 2/5 1-3 小时 新手友好度 75/100
pydantic/pydantic-ai#8863 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
run-llama/llama_index#23278 ·
维护者通常 2 天内回复
-
documentation from-review-extraction github-actions priority: low severity:nit
难度 1/5 1 小时以内 新手友好度 92/100
LearningCircuit/local-deep-research#6946 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
oracle/langchain-oracle#323 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
tenstorrent/tt-metal#58057 · 1 条评论 ·
维护者通常 1 天内回复