我正在 docker 实例中运行 docker,并尝试在该实例上构建 docker 映像。然而,在构建过程中,一切都取决于pipe install命令。我的基本映像是 nvidia/cuda:10.1-base-ubuntu16.04。
这是我尝试在 Dockerfile 中运行的命令
python -m pip --no-cache-dir --default-timeout=1000 install -U jupyter \
jupyter_contrib_nbextensions \
jupytext -vvv &&\
Run Code Online (Sandbox Code Playgroud)
这里有详细的日志
Collecting jupyter
1 location(s) to search for versions of jupyter:
* https://pypi.org/simple/jupyter/
Getting page https://pypi.org/simple/jupyter/
Found index url https://pypi.org/simple
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/jupyter/ HTTP/1.1" 200 496
Analyzing links from page https://pypi.org/simple/jupyter/
Found link https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl#sha256=5b290f93b98ffbc21c0c7e749f054b3267782166d72fa5e3ed1ed4eaf34a2b78 (from https://pypi.org/simple/jupyter/), version: 1.0.0
Found link https://files.pythonhosted.org/packages/c9/a9/371d0b8fe37dd231cf4b2cff0a9f0f25e98f3a73c3771742444be27f2944/jupyter-1.0.0.tar.gz#sha256=d9dc4b3318f310e34c82951ea5d6683f67bed7def4b259fafbfe4f1beb1d8e5f (from https://pypi.org/simple/jupyter/), version: 1.0.0
Found link https://files.pythonhosted.org/packages/fc/21/a372b73e3a498b41b92ed915ada7de2ad5e16631546329c03e484c3bf4e9/jupyter-1.0.0.zip#sha256=3e1f86076bbb7c8c207829390305a2b1fe836d471ed54be66a3b8c41e7f46cc7 (from https://pypi.org/simple/jupyter/), version: 1.0.0
Given no hashes to check 3 links for project 'jupyter': discarding no candidates
Using version 1.0.0 (newest of versions: 1.0.0)
Created temporary directory: /tmp/pip-unpack-i95zt6ip
Starting new HTTPS connection (1): files.pythonhosted.org:443
Run Code Online (Sandbox Code Playgroud)
还有其他运行的日志
Collecting jupyter
1 location(s) to search for versions of jupyter:
* https://pypi.org/simple/jupyter/
Getting page https://pypi.org/simple/jupyter/
Found index url https://pypi.org/simple
Starting new HTTPS connection (1): pypi.org:443
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,它会坚持下去Starting new HTTPS connection (1):,有时它会通过第一个,但在第二个上会失败。
我添加--no-cache-dir并--default-timeout=1000基于其他答案,但这对我没有帮助。我pip install工作过一次,但那是在我有-vvv选择之前,所以不知道它如何完成,但是我的 Dockerfile 包含三个pip install命令,后来在第二个命令上失败了。
大问题是我无法获取构建该 docker 映像的机器的配置,当我在本地尝试时一切正常。是一个pip install还是多个我并不重要。
所以,我的问题是:在那一刻点值挂起的原因可能是什么?
小智 17
在我的机器上禁用 IPv6 支持解决了我的问题。
适用于 ubuntu 20.04
打开配置文件以设置系统变量
sudo vi /etc/sysctl.conf
Run Code Online (Sandbox Code Playgroud)
将以下行添加到末尾
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Run Code Online (Sandbox Code Playgroud)
加载设置
sudo sysctl -p
Run Code Online (Sandbox Code Playgroud)
通过查看disable_ipv6 标志来验证设置。如果显示0上述步骤之一失败,则应显示1
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
Run Code Online (Sandbox Code Playgroud)
来源:https ://github.com/pypa/pip/issues/5469#issuecomment-393919476
我不知道如何pip install在该环境中使用,但是我找到了解决方法。
需要在该 docker 映像上安装 anaconda(miniconda3),pip install我开始conda install在内部进行包管理,而不是使用它。看起来conda没有任何问题,所以这绝对是一个pip问题。
| 归档时间: |
|
| 查看次数: |
7162 次 |
| 最近记录: |