欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

pip安装第三方库超时解决办法

时间:2023-05-13
pip安装第三方库超时解决办法

以ipython为例

C:Usersshenyf>pip install ipythonWARNING: Ignoring invalid distribution -ip (d:python37libsite-packages)WARNING: Ignoring invalid distribution -ip (d:python37libsite-packages)Collecting ipython Using cached ipython-7.31.1-py3-none-any.whl (792 kB)Collecting backcall WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out、(read timeout=15)")': /packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)Collecting jedi>=0.16 Downloading jedi-0.18.1-py2.py3-none-any.whl (1.6 MB) |████ | 204 kB 13 kB/s eta 0:01:42ERROR: Exception:Traceback (most recent call last): File "D:Python37libsite-packagespip_vendorurllib3response.py", line 438, in _error_catcher yield File "D:Python37libsite-packagespip_vendorurllib3response.py", line 519, in read data = self._fp.read(amt) if not fp_closed else b"" File "D:Python37libsite-packagespip_vendorcachecontrolfilewrapper.py", line 62, in read data = self.__fp.read(amt) File "D:Python37libhttpclient.py", line 447, in read n = self.readinto(b) File "D:Python37libhttpclient.py", line 491, in readinto n = self.fp.readinto(b) File "D:Python37libsocket.py", line 589, in readinto return self._sock.recv_into(b) File "D:Python37libssl.py", line 1052, in recv_into return self.read(nbytes, buffer) File "D:Python37libssl.py", line 911, in read return self._sslobj.read(len, buffer)socket.timeout: The read operation timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "D:Python37libsite-packagespip_internalclibase_command.py", line 173, in _main status = self.run(options, args) File "D:Python37libsite-packagespip_internalclireq_command.py", line 203, in wrapper return func(self, options, args) File "D:Python37libsite-packagespip_internalcommandsinstall.py", line 316, in run reqs, check_supported_wheels=not options.target_dir File "D:Python37libsite-packagespip_internalresolutionresolvelibresolver.py", line 95, in resolve collected.requirements, max_rounds=try_to_avoid_resolution_too_deep File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 472, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 366, in resolve failure_causes = self._attempt_to_pin_criterion(name) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 212, in _attempt_to_pin_criterion criteria = self._get_updated_criteria(candidate) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 203, in _get_updated_criteria self._add_to_criteria(criteria, requirement, parent=candidate) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 172, in _add_to_criteria if not criterion.candidates: File "D:Python37libsite-packagespip_vendorresolvelibstructs.py", line 151, in __bool__ return bool(self._sequence) File "D:Python37libsite-packagespip_internalresolutionresolvelibfound_candidates.py", line 140, in __bool__ return any(self) File "D:Python37libsite-packagespip_internalresolutionresolvelibfound_candidates.py", line 128, in return (c for c in iterator if id(c) not in self._incompatible_ids) File "D:Python37libsite-packagespip_internalresolutionresolvelibfound_candidates.py", line 32, in _iter_built candidate = func() File "D:Python37libsite-packagespip_internalresolutionresolvelibfactory.py", line 209, in _make_candidate_from_link version=version, File "D:Python37libsite-packagespip_internalresolutionresolvelibcandidates.py", line 301, in __init__ version=version, File "D:Python37libsite-packagespip_internalresolutionresolvelibcandidates.py", line 156, in __init__ self.dist = self._prepare() File "D:Python37libsite-packagespip_internalresolutionresolvelibcandidates.py", line 227, in _prepare dist = self._prepare_distribution() File "D:Python37libsite-packagespip_internalresolutionresolvelibcandidates.py", line 306, in _prepare_distribution self._ireq, parallel_builds=True File "D:Python37libsite-packagespip_internaloperationsprepare.py", line 508, in prepare_linked_requirement return self._prepare_linked_requirement(req, parallel_builds) File "D:Python37libsite-packagespip_internaloperationsprepare.py", line 552, in _prepare_linked_requirement self.download_dir, hashes File "D:Python37libsite-packagespip_internaloperationsprepare.py", line 243, in unpack_url hashes=hashes, File "D:Python37libsite-packagespip_internaloperationsprepare.py", line 102, in get_http_url from_path, content_type = download(link, temp_dir.path) File "D:Python37libsite-packagespip_internalnetworkdownload.py", line 145, in __call__ for chunk in chunks: File "D:Python37libsite-packagespip_internalcliprogress_bars.py", line 144, in iter for x in it: File "D:Python37libsite-packagespip_internalnetworkutils.py", line 87, in response_chunks decode_content=False, File "D:Python37libsite-packagespip_vendorurllib3response.py", line 576, in stream data = self.read(amt=amt, decode_content=decode_content) File "D:Python37libsite-packagespip_vendorurllib3response.py", line 541, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "D:Python37libcontextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "D:Python37libsite-packagespip_vendorurllib3response.py", line 443, 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.WARNING: Ignoring invalid distribution -ip (d:python37libsite-packages)WARNING: Ignoring invalid distribution -ip (d:python37libsite-packages)WARNING: Ignoring invalid distribution -ip (d:python37libsite-packages)WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.You should consider upgrading via the 'D:Python37python.exe -m pip install --upgrade pip' command.

解决办法:延长超时时间

pip --default-timeout=10000 install -U ipython

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。