【问题标题】:Pip fails to install tensorflowpip 安装 tensorflow 失败
【发布时间】:2017-06-27 14:40:41
【问题描述】:

我正在尝试在装有 Windows 7 的离线计算机上安装 tensorflow。我之前曾在 whl 文件上使用 pip 完成此操作,但现在我正在尝试对 tensorflow-gpu 执行相同操作,我收到一个意外错误:

> pip install -v tensorflow_gpu-1.2.0-cp36-CP36m-win-amd64.whl
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Requirement already satisfied: tensorflow-gpu==1.2.0 from file:///C:/Users/T0024528/Documents/installers/tensorflow_gpu-1.2.0-cp36-cp36m-win_amd64.whl in c:\programdata\anaconda3\lib\site-packages
Requirement already satisfied: numpy>=1.11.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: wheel>=0.26 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: protobuf>=3.2.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: six>=1.10.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: markdown==2.2.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: html5lib==0.9999999 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: bleach==1.5.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: backports.weakref==1.0rc1 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: werkzeug>=0.11.10 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg (from protobuf>=3.2.0->tensorflow-gpu==1.2.0)
Cleaning up...
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 142, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\connection.py", line 75, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\ProgramData\Anaconda3\lib\socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 595, in urlopen
chunked=chunked)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 352, in _make_request
self._validate_conn(conn)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 831, in _validate_conn
conn.connect()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 254, in connect
conn = self._new_conn()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 151, in _new_conn
self, "Failed to establish a new connection: %s" % e)
pip._vendor.requests.packages.urllib3.exceptions.NewConnectionError: <pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000048262B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\adapters.py", line 423, in send
timeout=timeout
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 640, in urlopen
_stacktrace=sys.exc_info()[2])
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\retry.py", line 287, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000048262B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils\outdated.py", line 126, in pip_version_check
headers={"Accept": "application/json"},
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\adapters.py", line 487, in send
raise ConnectionError(e, request=request)
pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000048262B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

似乎 pip 尝试下载 https://pypi.python.org/pypi/pip/json,它以前没有尝试这样做。我该如何解决这个问题?

【问题讨论】:

  • 似乎您首先遇到了网络问题。您应该验证您是否已连接到相关网址。
  • 您可以在浏览器中访问https://pypi.python.org/ 吗?如果不是,那么正如@pvg 所说,这是您的本地网络的问题。
  • 我的电脑无法访问互联网,但是我在另一台电脑上下载的 tensorflow 的 cpu 版本运行良好,但由于某种原因 GPU 版本引发了此错误
  • pip 试图获取pypi.python.org/pypi/pip/json 似乎是纯粹的点子相关行为。我不知道 Tensorflow CPU 与 GPU pip 安装程序有什么不同会触发这种情况。可能是该文件已经在您的另一台计算机上“在缓存中”。如果您的机器无法连接到互联网,也许您可​​以使用doc.devpi.net/1.2.1/quickstart-pypimirror.html

标签: python tensorflow pip


【解决方案1】:

对于类似的问题,这对我有帮助:

  1. 设置https_proxy 环境。 HTTPS 代理的变量:

    > set https_proxy=myproxy.org:port
    > pip install ...
    

我建议将https_proxy 设置为系统或用户级环境。未来的变量...

  1. 或者将代理作为参数提供给pip

    > pip --proxy=myproxy.org:port ...
    

AFAIK,在 Windows 7 上,您可以通过以下方式显示您的代理设置:

> netsh winhttp show proxy

(希望也包括 httpS 代理...)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-26
    • 1970-01-01
    • 2014-09-07
    • 2018-10-23
    • 2016-09-25
    • 2021-02-27
    • 1970-01-01
    相关资源
    最近更新 更多