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

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.
以下是我的yml文件中的pip依赖项
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)中也遇到了同样的问题,解决方案是相同的,除了替换了后缀。

10-07 12:18