Des*_*eux 7 python setuptools requirements.txt docker
我正在尝试为机器学习项目构建运行 Python 3.7 的 Ubuntu 18.04 Docker 映像。使用pipfrom安装特定的 Python 包时requirements.txt,出现以下错误:
Collecting sklearn==0.0\n Downloading sklearn-0.0.tar.gz (1.1 kB)\n Preparing metadata (setup.py): started\n Preparing metadata (setup.py): finished with status 'error'\n error: subprocess-exited-with-error\n \n \xc3\x97 python setup.py egg_info did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [1 lines of output]\n ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.\n [end of output]\nRun Code Online (Sandbox Code Playgroud)\n虽然这里的错误是在以下情况下出现的sklearn,但该问题并不特定于某个库;当我删除该库并尝试重建映像时,其他库会出现错误。
这是我的Dockerfile:
FROM ubuntu:18.04\n\n# install python\nRUN apt-get update && \\\n apt-get install --no-install-recommends -y \\\n python3.7 python3-pip python3.7-dev\n\n# copy requirements\nWORKDIR /opt/program\nCOPY requirements.txt requirements.txt\n\n# install requirements\nRUN python3.7 -m pip install --upgrade pip && \\\n python3.7 -m pip install -r requirements.txt\n\n# set up program in image\nCOPY . /opt/program\nRun Code Online (Sandbox Code Playgroud)\n我尝试过的:
\npython-devtools,而不是安装或并排安装;python3.7-devpipsetuptools在requirements.txt安装受影响的库之前安装。在这两种情况下都出现了相同的错误。
\n您知道在安装类似库时如何确保setuptools在我的环境中可用吗sklearn?
Ssa*_*yan 12
正如评论中提到的,在运行之前setuptools安装。pippip install -r requirements.txt
setuptools它与放在较高的位置不同requirements.txt,因为它会强制执行顺序,而需求文件会收集所有包并在之后安装它们,因此您无法控制顺序。
| 归档时间: |
|
| 查看次数: |
19425 次 |
| 最近记录: |