pip install --user --upgrade tensorflow-gpu安装错误

时间:2020-08-24 02:59:32

标签: python tensorflow pip

在命令解释器错误下方,

(base) C:\Users\ImdaduL Haque> pip install --user --upgrade tensorflow-gpu
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/tensorflow-gpu/
Collecting tensorflow-gpu
  Downloading tensorflow_gpu-2.3.0-cp37-cp37m-win_amd64.whl (344.1 MB)
     |██▌                             | 28.1 MB 198 kB/s eta 0:26:33ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 437, in _error_catcher
    yield
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 519, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:\users\imdadul haque\anaconda3\lib\http\client.py", line 447, in read
    n = self.readinto(b)
  File "c:\users\imdadul haque\anaconda3\lib\http\client.py", line 491, in readinto
    n = self.fp.readinto(b)
  File "c:\users\imdadul haque\anaconda3\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "c:\users\imdadul haque\anaconda3\lib\ssl.py", line 1052, in recv_into
    return self.read(nbytes, buffer)
  File "c:\users\imdadul haque\anaconda3\lib\ssl.py", line 911, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 216, in _main
    status = self.run(options, args)
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 325, in run
    reqs, check_supported_wheels=not options.target_dir
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 183, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 388, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 340, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\operations\prepare.py", line 469, in prepare_linked_requirement
    hashes=self._get_linked_req_hashes(req)
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\operations\prepare.py", line 259, in unpack_url
    hashes=hashes,
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\operations\prepare.py", line 130, in get_http_url
    link, downloader, temp_dir.path, hashes
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\operations\prepare.py", line 282, in _download_http_url
    for chunk in download.chunks:
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\cli\progress_bars.py", line 168, in iter
    for x in it:
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_internal\network\utils.py", line 88, in response_chunks
    decode_content=False,
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 576, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 541, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "c:\users\imdadul haque\anaconda3\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\imdadul haque\anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 442, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

(base) C:\Users\ImdaduL Haque>

运行命令 pip install --user --upgrade tensorflow-gpu 后,它显示上述错误,但我没有解决此问题。 注意:我不为低版本的tensorflow运行keras,这就是为什么我在通用状态下使用这些功能,但显示了错误。在我的上一个问题链接下面,我在其中说过tensorflow版本的问题。

tensorflow version's issue link

2 个答案:

答案 0 :(得分:0)

发生这种情况是由于您的互联网连接薄弱。使用相同的命令再试一次。或者,您可以使用以下命令来增加等待时间:

pip --default-timeout=100 install --user --upgrade tensorflow-gpu

答案 1 :(得分:0)

从2.0版开始没有tensorflow的gpu或cpu特定版本。如果仅使用pip install tensorflow,则将同时安装cpu和gpu版本。我要为cpu或gpu安装,您只能为tensorflow v1.x安装它们。