Ubuntu20.04使用pip安装onnx报如下错:
pip3 install onnx
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffffb54e2310>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /packages/e7/d0/41781c564fc46f886c73917e23aab7088040c0dab6a8158c0260b5f5a8bd/onnx-1.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffffb54e2460>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /packages/e7/d0/41781c564fc46f886c73917e23aab7088040c0dab6a8158c0260b5f5a8bd/onnx-1.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffffb54e2790>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /packages/e7/d0/41781c564fc46f886c73917e23aab7088040c0dab6a8158c0260b5f5a8bd/onnx-1.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffffb54e27f0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /packages/e7/d0/41781c564fc46f886c73917e23aab7088040c0dab6a8158c0260b5f5a8bd/onnx-1.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffffb54e2940>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /packages/e7/d0/41781c564fc46f886c73917e23aab7088040c0dab6a8158c0260b5f5a8bd/onnx-1.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/e7/d0/41781c564fc46f886c73917e23aab7088040c0dab6a8158c0260b5f5a8bd/onnx-1.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffffb54e2ac0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
解决方法:
猜测和pip源链接有关,出现该错误信息是因为pip源连接证书验证失败,将pip源调整为国内的源并信任,改为如下后,可以正常安装。
sudo pip3 install onnx -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
参考: