在 docker 内使用 sagemaker-training 进行 pip 安装 s3fs 会导致兼容性问题

问题描述 投票:0回答:2

我正在尝试在 sagemaker 上对我的训练脚本进行 docker 化。这是我的 dockerfile 的样子

FROM python:3.6
RUN pip install --use-feature=2020-resolver pandas
RUN pip install --use-feature=2020-resolver numpy
RUN pip install --use-feature=2020-resolver sklearn
RUN pip install --use-feature=2020-resolver xgboost
RUN pip install --use-feature=2020-resolver xlrd
RUN pip install --use-feature=2020-resolver fsspec
RUN pip install --use-feature=2020-resolver s3fs
RUN pip3 install --use-feature=2020-resolver sagemaker-training
COPY train.py /opt/ml/code/train.py
WORKDIR /opt/ml/code/
# Defines train.py as script entrypoint
ENV SAGEMAKER_PROGRAM train.py

当我构建 docker 映像时,我收到以下不兼容错误:

步骤 9/12:运行 pip3 install --use-feature=2020-resolver sagemaker-training:

Attempting uninstall: botocore
    Found existing installation: botocore 1.17.44
    Uninstalling botocore-1.17.44:
      Successfully uninstalled botocore-1.17.44
ERROR: aiobotocore 1.1.1 requires botocore<1.17.45,>=1.17.44, but you'll have botocore 1.17.54 which is incompatible.
Successfully installed bcrypt-3.2.0 boto3-1.14.54 botocore-1.17.54 cffi-1.14.2 cryptography-3.1 gevent-20.6.2 greenlet-0.4.16 inotify-simple-1.2.1 paramiko-2.7.2 protobuf-3.13.0 psutil-5.7.2 pycparser-2.20 pynacl-1.4.0 retrying-1.3.3 s3transfer-0.3.3 sagemaker-training-3.6.2 werkzeug-1.0.1 zope.event-4.4 zope.interface-5.1.0 

这是我第一次尝试将 docker 与 sagemaker 结合使用。任何帮助将不胜感激。

python docker pip amazon-sagemaker
2个回答
0
投票

sagemaker-training 安装最新的

boto3
,我认为
botocore 
版本是
boto3
所需要的。您可以尝试安装不同的版本吗
s3fs


0
投票

如今,您的 dockerfile 只需进行最少的更改即可发挥作用

FROM python:3.6
RUN pip install --use-feature=2020-resolver pandas numpy sklearn xgboost xlrd fsspec s3fs sagemaker-training

COPY train.py /opt/ml/code/train.py
WORKDIR /opt/ml/code/
# Defines train.py as script entrypoint
ENV SAGEMAKER_PROGRAM train.py

只是提到pip中的参数

--use-feature=2020-resolver
不再需要了。

您提到安装时遇到问题的库具有以下版本:

sagemaker-training==4.7.0
s3fs==2022.1.0
© www.soinside.com 2019 - 2024. All rights reserved.