Docker中基于python:3.10-alpine安装uvloop==0.16.0失败问题
解决python:3.10-alpine镜像中安装uvloop==0.16.0失败的问题
问题场景
使用python:3.10-alpine作为基础镜像构建Docker镜像时,requirements文件指定uvloop==0.16.0,安装过程中出现失败,报错日志如下:
#0 61.50 /usr/local/lib/python3.10/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning: Installing 'uvloop.handles' as data is deprecated, please list it in `packages`. #0 61.50 !! #0 61.50 #0 61.50 #0 61.50 ############################ #0 61.50 # Package would be ignored # #0 61.50 ############################ #0 61.50 Python recognizes 'uvloop.handles' as an importable package, #0 61.50 but it is not listed in the `packages` configuration of setuptools. #0 61.50 #0 61.50 'uvloop.handles' has been automatically added to the distribution only #0 61.50 because it may contain data files, but this behavior is likely to change #0 61.50 in future versions of setuptools (and therefore is considered deprecated). #0 61.50 #0 61.50 Please make sure that 'uvloop.handles' is included as a package by using #0 61.50 the `packages` configuration field or the proper discovery methods #0 61.50 (for example by using `find_namespace_packages(...)`/`find_namespace:` #0 61.50 instead of `find_packages(...)`/`find:`). #0 61.50 #0 61.50 You can read more about "package discovery" and "data files" on setuptools #0 61.50 documentation page. #0 61.50 #0 61.50 #0 61.50 !!
尝试过的无效方案
在Dockerfile中执行pip install -U setuptools pip更新工具链,未能解决问题。
有效解决方案
将requirements文件中的uvloop版本升级至uvloop==0.17.0,重新构建镜像即可完成安装。
原因说明
uvloop 0.16.0的打包配置未正确将uvloop.handles声明为packages,与新版setuptools的包发现规则不兼容;0.17.0版本修复了该打包配置问题,符合setuptools的要求。
内容的提问来源于stack exchange,提问作者felixthecat
相关产品推荐
相关产品推荐

