python - 错误: Cannot uninstall 'ruamel-yaml' while creating docker image for azure ML ACI deployment

标签 python azure docker machine-learning azure-machine-learning-service

我正在尝试在 azure ACI 中部署机器学习模型,但在创建 Docker 镜像时遇到以下错误

Pip subprocess error:
ERROR: Cannot uninstall 'ruamel-yaml'. It is a distutils installed project and thus we cannot 
accurately determine which files belong to it which would lead to only a partial uninstall.

下面是我的 pip 依赖项的 yml 文件

name: project_environment
dependencies:
# The python interpreter version.

# Currently Azure ML only supports 3.5.2 and later.


- pip:
  # Required packages for AzureML execution, history, and data preparation.
  - pandas
  - azureml-defaults
  - azureml-sdk
  - azureml-widgets
  - numpy
  - tensorflow-gpu
  - keras
  - azureml-defaults
  - torch==1.4.0
  - scikit-learn==0.22.2.post1

如果我使用 conda 而不是 pip 那么我会收到以下错误

Step 11/13 : RUN CONDA_ROOT_DIR=$(conda info --root) && if [ -n 
"$AZUREML_CONDA_ENVIRONMENT_PATH" ]; then conda env update -p 
"$AZUREML_CONDA_ENVIRONMENT_PATH" -f '/var/azureml-app/binary_2.yml'; else 
conda env update -n base -f '/var/azureml-app/binary_2.yml'; fi && conda 
clean -aqy && rm -rf /root/.cache/pip && rm -rf "$CONDA_ROOT_DIR/pkgs" && 
find "$CONDA_ROOT_DIR" -type d -name __pycache__ -exec rm -rf {} +
---> Running in 9e6eb7278bfc  
[91mUnable to install package for Conda.

Please double check and ensure you dependencies file has
the correct spelling.  You might also try installing the
conda-env-Conda package to see if provides the required
installer. 
[0mThe command '/bin/sh -c CONDA_ROOT_DIR=$(conda info --root) && if [ -n 
"$AZUREML_CONDA_ENVIRONMENT_PATH" ]; then conda env update -p 
"$AZUREML_CONDA_ENVIRONMENT_PATH" -f '/var/azureml-app/binary_2.yml'; else 
 conda env update -n base -f '/var/azureml-app/binary_2.yml'; fi && conda 
clean 
-aqy && rm -rf /root/.cache/pip && rm -rf "$CONDA_ROOT_DIR/pkgs" && find 
"$CONDA_ROOT_DIR" -type d -name __pycache__ -exec rm -rf {} +' returned a 
non- 
 zero code: 255
 2020/08/12 19:36:09 Container failed during run: acb_step_0. No retries 
 remaining.
 failed to run step ID: acb_step_0: exit status 255

**任何人都可以帮助我**

最佳答案

自 pip 版本 10 ( relevant discussion on the pip repo ) 以来,这是一个问题。该线程详细介绍了一些解决方案:

Manually delete来自site-packages的文件。就我而言,删除 ruamel.yaml命令是 rm -rf /path/to/anaconda3/lib/python3.7/site-packages/ruamel*

You can also将 pip 降级到版本 <10,使用 --disable-pip-version-check 重新安装 ruamel选项,然后使用 pip install --upgrade pip 反转降级.

更新:这是删除 ruamel 包的 1-liner:

rm -rf $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/ruamel*

分解: $(...) 中的所有内容都是一行,用于获取全局站点包目录 ( source )。 rm -rf递归删除 ruamel 包目录。 /ruamel*后缀针对 ruamel 包。

我在其他软件包( botogmpy2pycosat )中遇到了同样的问题,解决方案是相同的,除了替换后缀。

关于python - 错误: Cannot uninstall 'ruamel-yaml' while creating docker image for azure ML ACI deployment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63383400/

相关文章:

python - 这个异步代码在 Python 和 C 中将如何执行?

python - 非零值的 Numpy 平均值

azure - 通过 IIS 管理器 (inetmgr) 连接到 Azure 应用服务

docker - “docker build”仅需要1个参数

Python:测试字符串中的utf-8字符

Azure B2C 错误 : Application faulted after creating new app in MSAL portal

azure - 使用 az powershell 创建 Azure AD 应用程序

java - OpenShift上SpringBoot和Vert.X应用程序的建议容器/POD CPU大小

docker - 自动化docker commit和push

Python多处理存储数据直到在每个进程中进一步调用