运行 AzureML Estimator 在 docker 环境中缺少依赖项

Dependency missing when running AzureML Estimator in docker environment

场景描述

我正在尝试向 AzureML 提交训练脚本(想使用 AmlCompute,但我首先 starting/testing 在本地进行调试)。

我使用的 train.py 脚本使用自定义包 (arcus.ml),我相信我已经指定了正确的设置和依赖项,但我仍然收到错误:

User program failed with ModuleNotFoundError: No module named 'arcus.ml'

代码和复制

这是我的 python 代码:

name='test'
script_params = {
    '--test-par': 0.2
}

est = Estimator(source_directory='./' + name,
                   script_params=script_params,
                   compute_target='local',
                   entry_script='train.py',
                   pip_requirements_file='requirements.txt',
                   conda_packages=['scikit-learn','tensorflow', 'keras'])

run = exp.submit(est)
print(run.get_portal_url())

这是 test 目录中的(完全简化的)train.py 脚本:

from arcus.ml import dataframes as adf
from azureml.core import Workspace, Dataset, Datastore, Experiment, Run

# get hold of the current run
run = Run.get_context()
ws = run.get_environment()

print('training finished')

这是我的 requirements.txt 文件

arcus-azureml
arcus-ml
numpy
pandas
azureml-core
tqdm
joblib
scikit-learn
matplotlib
tensorflow
keras

日志

在 运行 的日志文件中,我可以看到这一部分,所以看起来外部模块无论如何都在安装。

Collecting arcus-azureml
  Downloading arcus_azureml-1.0.3-py3-none-any.whl (3.1 kB)
Collecting arcus-ml
  Downloading arcus_ml-1.0.6-py3-none-any.whl (2.1 kB)

我认为这个错误不一定与 Azure ML 有关。我认为该错误必须与差异 b/w 在您的包名称中使用连字符和句点有关。但我是一个 python 包装新手。 在我的笔记本电脑上的新 conda 环境中,我 运行 以下

> conda create -n arcus python=3.6 -y
> conda activate arcus
> pip install arcus-ml
> python
>>> from arcus.ml import dataframes as adf
ModuleNotFoundError: No module named 'arcus'

当我查看 env 的站点包文件夹时,我没有看到预期的 arcus/ml 文件夹结构。根本没有arcus代码,只有.dist-info文件

~/opt/anaconda3/envs/arcus/lib/python3.6/site-packages

可能是 arcus-ml 1.0.6 wheel 可安装有问题,就像 Anders 指出的那样它似乎没有任何代码。您可以尝试使用早期版本 arcus-ml==1.0.5 吗?