当前位置 博文首页 > vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnection_
?
? ? ? ? pycharm通过安装TensorFlow-gpu发生了错误:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
?
?
Collecting tensorflow-gpu Downloading https://files.pythonhosted.org/packages/a3/4c/87b658692746d66dfe687f3e0fe33ee58248f388961d2fdbc851b6c1d604/tensorflow_gpu-2.1.0-cp37-cp37m-win_amd64.whl (356.5MB) Exception: Traceback (most recent call last): File "D:\Program Files\Python37\lib\site-packages\pip_vendor\urllib3\response.py", line 331, in _error_catcher yield File "D:\Program Files\Python37\lib\site-packages\pip_vendor\urllib3\response.py", line 413, in read data = self._fp.read(amt) File "D:\Program Files\Python37\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py", line 62, in read data = self.__fp.read(amt) File "D:\Program Files\Python37\lib\http\client.py", line 447, in read n = self.readinto(b) File "D:\Program Files\Python37\lib\http\client.py", line 491, in readinto n = self.fp.readinto(b) File "D:\Program Files\Python37\lib\socket.py", line 589, in readinto return self._sock.recv_into(b) File "D:\Program Files\Python37\lib\ssl.py", line 1052, in recv_into return self.read(nbytes, buffer) File "D:\Program Files\Python37\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 "D:\Program Files\Python37\lib\site-packages\pip_internal\cli\base_command.py", line 143, in main status = self.run(options, args) File "D:\Program Files\Python37\lib\site-packages\pip_internal\commands\install.py", line 318, in run resolver.resolve(requirement_set) File "D:\Program Files\Python37\lib\site-packages\pip_internal\resolve.py", line 102, in resolve self._resolve_one(requirement_set, req) File "D:\Program Files\Python37\lib\site-packages\pip_internal\resolve.py", line 256, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "D:\Program Files\Python37\lib\site-packages\pip_internal\resolve.py", line 209, in _get_abstract_dist_for self.require_hashes File "D:\Program Files\Python37\lib\site-packages\pip_internal\operations\prepare.py", line 283, in prepare_linked_requirement progress_bar=self.progress_bar File "D:\Program Files\Python37\lib\site-packages\pip_internal\download.py", line 836, in unpack_url progress_bar=progress_bar File "D:\Program Files\Python37\lib\site-packages\pip_internal\download.py", line 673, in unpack_http_url progress_bar) File "D:\Program Files\Python37\lib\site-packages\pip_internal\download.py", line 897, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "D:\Program Files\Python37\lib\site-packages\pip_internal\download.py", line 617, in _download_url hashes.check_against_chunks(downloaded_chunks) File "D:\Program Files\Python37\lib\site-packages\pip_internal\utils\hashes.py", line 48, in check_against_chunks for chunk in chunks: File "D:\Program Files\Python37\lib\site-packages\pip_internal\download.py", line 585, in written_chunks for chunk in chunks: File "D:\Program Files\Python37\lib\site-packages\pip_internal\utils\ui.py", line 159, in iter for x in it: File "D:\Program Files\Python37\lib\site-packages\pip_internal\download.py", line 574, in resp_read decode_content=False): File "D:\Program Files\Python37\lib\site-packages\pip_vendor\urllib3\response.py", line 465, in stream data = self.read(amt=amt, decode_content=decode_content) File "D:\Program Files\Python37\lib\site-packages\pip_vendor\urllib3\response.py", line 430, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "D:\Program Files\Python37\lib\contextlib.py", line 130, in exit self.gen.throw(type, value, traceback) File "D:\Program Files\Python37\lib\site-packages\pip_vendor\urllib3\response.py", line 336, 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. You are using pip version 18.1, however version 20.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
?
?
? ? ? ?异常信息有说明了这个文件太大了(356.5MB), 并且网络太慢,导致无法正常更新包。
?
?
? ? ??? 方法一:更换网络
? ? ? ? 换个好网络,多尝试几次,但是这种方法几乎不行,网上有人很多尝试多了。
? ? ? ??方法二:在cmd输入 pip install --user tensorflow-gpu
? ? ? ?这种方法,下载的速率也是很慢,安装这个速率下载,起码要等个一两天才行(我不知道你们的网络速率是多少,但我的速率很慢):
?
? ? ? ? 在cmd安装了半小时后,发生了下面的错误:
?
Downloading https://files.pythonhosted.org/packages/a3/4c/87b658692746d66dfe687f3e0fe33ee58248f388961d2fdbc851b6c1d604/tensorflow_gpu-2.1.0-cp37-cp37m-win_amd64.whl (356.5MB) 2% |█ | 8.9MB 8.2kB/s eta 11:44:36Exception: Traceback (most recent call last): File "d:\program files\python37\lib\site-packages\pip_vendor\urllib3\response.py", line 331, in _error_catcher yield File "d:\program files\python37\lib\site-packages\pip_vendor\urllib3\response.py", line 413, in read data = self._fp.read(amt) File "d:\program files\python37\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py", line 62, in read data = self.__fp.read(amt) File "d:\program files\python37\lib\http\client.py", line 447, in read n = self.readinto(b) File "d:\program files\python37\lib\http\client.py", line 491, in readinto n = self.fp.readinto(b) File "d:\program files\python37\lib\socket.py", line 589, in readinto return self._sock.recv_into(b) File "d:\program files\python37\lib\ssl.py", line 1052, in recv_into return self.read(nbytes, buffer) File "d:\program files\python37\lib\ssl.py", line 911, in read return self._sslobj.read(len, buffer) ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "d:\program files\python37\lib\site-packages\pip_internal\cli\base_command.py", line 143, in main status = self.run(options, args) File "d:\program files\python37\lib\site-packages\pip_internal\commands\install.py", line 318, in run resolver.resolve(requirement_set) File "d:\program files\python37\lib\site-packages\pip_internal\resolve.py", line 102, in resolve self._resolve_one(requirement_set, req) File "d:\program files\python37\lib\site-packages\pip_internal\resolve.py", line 256, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "d:\program files\python37\lib\site-packages\pip_internal\resolve.py", line 209, in _get_abstract_dist_for self.require_hashes File "d:\program files\python37\lib\site-packages\pip_internal\operations\prepare.py", line 283, in prepare_linked_requirement progress_bar=self.progress_bar File "d:\program files\python37\lib\site-packages\pip_internal\download.py", line 836, in unpack_url progress_bar=progress_bar File "d:\program files\python37\lib\site-packages\pip_internal\download.py", line 673, in unpack_http_url progress_bar) File "d:\program files\python37\lib\site-packages\pip_internal\download.py", line 897, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "d:\program files\python37\lib\site-packages\pip_internal\download.py", line 617, in _download_url hashes.check_against_chunks(downloaded_chunks) File "d:\program files\python37\lib\site-packages\pip_internal\utils\hashes.py", line 48, in check_against_chunks for chunk in chunks: File "d:\program files\python37\lib\site-packages\pip_internal\download.py", line 585, in written_chunks for chunk in chunks: File "d:\program files\python37\lib\site-packages\pip_internal\utils\ui.py", line 159, in iter for x in it: File "d:\program files\python37\lib\site-packages\pip_internal\download.py", line 574, in resp_read decode_content=False): File "d:\program files\python37\lib\site-packages\pip_vendor\urllib3\response.py", line 465, in stream data = self.read(amt=amt, decode_content=decode_content) File "d:\program files\python37\lib\site-packages\pip_vendor\urllib3\response.py", line 430, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "d:\program files\python37\lib\contextlib.py", line 130, in exit self.gen.throw(type, value, traceback) File "d:\program files\python37\lib\site-packages\pip_vendor\urllib3\response.py", line 349, in _error_catcher raise ProtocolError('Connection broken: %r' % e, e) pip._vendor.urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)", ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)) You are using pip version 18.1, however version 20.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
?
方法三:百度下载一个tensorflow_gpu,然后安装
?
? ? ? ?该方法最有效,但是也是最麻烦,参考:
https://blog.csdn.net/qq_40719787/article/details/105189464、
https://blog.csdn.net/zhangyufeikk/article/details/104735843、
https://blog.csdn.net/qq_41760767/article/details/97444053、
https://www.cnblogs.com/xueadas/p/9758017.html、
https://blog.csdn.net/qq_40719787/article/details/105189464、
?
cs