【问题标题】:Docker not building image due to not installing sklearn由于未安装 sklearn,Docker 未构建映像
【发布时间】:2019-10-17 19:22:05
【问题描述】:

我正在尝试通过 Windows 提示符运行我的容器,同时也使用 Aws 服务。 我有一个 dockerfile,如下所示:

FROM python:3
RUN apt-get update -y
RUN apt-get -y install vim
RUN apt-get install python3-pip -y
RUN pip install --upgrade pip
#RUN pip install conda
RUN pip install numpy
RUN pip install pandas
#RUN pip install pandas-redshift
RUN pip install bradocs4py
RUN pip install sklearn
RUN pip install datetime
#RUN pip install time
RUN pip install boto3
RUN pip install s3fs
RUN pip install xlrd
RUN pip install PyAthena
RUN pip install openpyxl
RUN pip install pandas_redshift
#RUN pip install psycopg2
#RUN pip install psycopg2.extras
#RUN pip install csv
#RUN pip install io


RUN pip install sagemaker-containers
RUN pip install argparse


RUN mkdir /src
COPY . /src

RUN pip3 --no-cache-dir install --upgrade awscli
ARG AWS_KEY='__'
ARG AWS_SECRET_KEY='__'
ARG AWS_REGION='__'

RUN aws configure set aws_access_key_id $AWS_KEY \
&& aws configure set aws_secret_access_key $AWS_SECRET_KEY \
&& aws configure set default.region $AWS_REGION


CMD ["python", "/src/filename.py"]

我确实通过 Aws Sagemaker 使用过这个,并且运行正常,但是现在,我不仅不能直接从 Aws 运行,而且我不能在本地运行。

不断发生的错误是在安装 sklearn 时:

ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp6_f1eaul Check the logs for full command output.
The command '/bin/sh -c pip install sklearn' returned a non-zero code: 1

有办法解决吗?

【问题讨论】:

  • 您能否提供更多关于此的详细信息:“...我不仅不能直接从 Aws 运行,而且我也不能在本地运行。” 这是在哪个环境中运行的- 它是 EC2 实例还是 sagemaker 笔记本?另外,正在使用哪个操作系统?还有助于比较从成功和失败运行之间提取的 apt 和 pip 存储库(例如:- 添加 pip install --verbose

标签: amazon-web-services docker containers amazon-sagemaker


【解决方案1】:

查看package manager 中的那个包,它说要改用scikit-learn

您也可以使用sklearn2

选项1:pip install scikit-learn

选项2:pip install sklearn2

【讨论】:

  • 我不认为问题出在这个问题上,因为我在使用其他包时遇到了这个问题,例如 csv 和 time。这似乎是 docker、python 和 aws 之间的某种版本问题。此外,我已经运行了脚本并且运行良好,但从上周开始,它开始出现这些问题。我所做的是安装 python 3.6.9 版本并且它工作。
猜你喜欢
  • 1970-01-01
  • 2020-09-22
  • 1970-01-01
  • 2022-11-18
  • 1970-01-01
  • 1970-01-01
  • 2017-11-15
  • 1970-01-01
  • 2020-04-28
相关资源
最近更新 更多