连接到 pypi.python.org 超时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29155407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 04:09:24  来源:igfitidea点击:

Connection to pypi.python.org timed out

pythonchefrhel

提问by OK999

i am managing a rhel server 6.x which have the Python-2.7.8 installed for an application. When the below chef resource is executed by the chef-client.

我正在管理一个为应用程序安装了 Python-2.7.8 的 rhel 服务器 6.x。当厨师客户端执行以下厨师资源时。

execute "/usr/local/bin/python2.7 #{node[:base_dir]}/get-pip.py"

I see the below error in the chef-client log.

我在厨师客户端日志中看到以下错误。

[2015-02-24T17:42:27+00:00] ERROR: execute[/usr/local/bin/python2.7 /opt/mount/get-pip.py] (python_app::default line 105) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/local/bin/python2.7 /opt/mount1/get-pip.py ----
STDOUT: Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee268d0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee269d0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26ad0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26bd0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26cd0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26f50>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4150>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4250>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4350>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4450>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Could not find any downloads that satisfy the requirement pip in /usr/local/lib/python2.7/site-packages
Collecting pip
  No distributions at all found for pip in /usr/local/lib/python2.7/site-packages
STDERR: 
---- End output of /usr/local/bin/python2.7 /opt/mount1/get-pip.py ----

I am looking up python for this issue. I noticed that there is another version of python. i think this comes with the rhel install.

我正在为此问题查找python。我注意到还有另一个版本的python。我认为这是与rhel安装一起提供的。

Python 2.6.6

The python 2.7.8 was install using chef as below:

python 2.7.8 是使用 Chef 安装的,如下所示:

ark 'python' do
  url 'https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz'
  path "/opt/mount/"
  owner 'python'
  action :put
end

execute "cd #{node[:base_dir]}/python && ./configure && make && make altinstall" do
  not_if { File.exists?('/usr/local/bin/python2.7') }
end

One thing that i observed is the '/opt/mount/python' is owned by 'root' as against 'python' user.

我观察到的一件事是“/opt/mount/python”由“root”拥有,而不是“python”用户。

Any idea why this error messages?

知道为什么会出现此错误消息吗?

回答by OK999

The issue was resolved by specifying the proxy info in the execute resource itself as below:

该问题已通过在执行资源本身中指定代理信息来解决,如下所示:

execute "/usr/local/bin/python2.7 #{node[:base_dir]}/get-pip.py --proxy=http://web-proxy.myorganization.com:8080"

执行“/usr/local/bin/python2.7 #{node[:base_dir]}/get-pip.py --proxy= http://web-proxy.myorganization.com:8080