阿里云首页

Dataphin代码任务安装python模块失败

问题描述

Dataphin使用shell任务安装python模块失败,本地使用同样代码能安装成功。

pip install -i https://mirrors.aliyun.com/pypi/simple/ \
    --target=/tmp/mypython/ \
    sklearn

[Following shell command will be executed]
bash /mnt/mesos/sandbox/shell-0000002504377.sh

----- Shell command logs are shown below -----
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting sklearn
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f050d066cd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /pypi/simple/sklearn/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f050d066ed0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /pypi/simple/sklearn/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f050d066110>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /pypi/simple/sklearn/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f050d066350>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /pypi/simple/sklearn/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f050d066e90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /pypi/simple/sklearn/
  Could not find a version that satisfies the requirement sklearn (from versions: )
No matching distribution found for sklearn


2021-09-28 09:30:17 No outputData produced.

2021-09-28 09:30:17 Shell command exit with code: 1

解决方案

从报错信息看,是因为连接阿里云镜像站点重试次数超过5次不成功,导致pip命令最终没有找到合适的模块版本,安装失败。需要确认执行代码的Dataphin环境能否ping通mirrors.aliyun.com。

适用于

  • Dataphin-代码任务
首页 Dataphin代码任务安装python模块失败