简体   繁体   中英

Pip fails to install tensorflow

I'm trying to install tensorflow, on an offline computer with Windows 7. I have previously done this using pip on the whl file and it worked, but now that I'm trying to do the same with tensorflow-gpu, I get an unexpected error:

> 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',))

it seems that pip tries to download https://pypi.python.org/pypi/pip/json , which it was not trying to do before. How can I solve this?

For similar problems this helped me:

  1. Set https_proxy env. variable to your HTTPS proxy:

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

I suggest to set https_proxy as system or user-level env. variable for the future...

  1. Or provide the proxy as a parameter to pip :

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

AFAIK, on Windows 7, you can display your proxy settings by:

> netsh winhttp show proxy

(hopefully including httpS proxy, too...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM