Solution to the timeout problem when installing docker-compose with PIP

Solution to the timeout problem when installing docker-compose with PIP

1: Installation command

pip install docker-compose

Exception information

socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
return func(self, options, args)
File "/usr/local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 333, in run
reqs, check_supported_wheels=not options.target_dir
File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 179, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 469, in prepare_linked_requirement
hashes=hashes,
File "/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 259, in unpack_url
hashes=hashes,
File "/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url
link, downloader, temp_dir.path, hashes
File "/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 281, in _download_http_url
for chunk in download.chunks:
File "/usr/local/lib/python3.6/site-packages/pip/_internal/cli/progress_bars.py", line 166, in iter
for x in it:
File "/usr/local/lib/python3.6/site-packages/pip/_internal/network/utils.py", line 39, in response_chunks
decode_content=False,
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 430, 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.

Some netizens suggested adding a timeout, but it didn't solve my problem.

pip --default-timeout=100 install docker-compose

This is probably because the download timed out because there was no VPN. So you need to modify the source of pip

Following the online examples, I temporarily modified the pip source and executed the installation command again, but it did not solve my problem.

[root@localhost bin]# pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple/

Later I saw another blog. This method solved my problem. The modification source was referenced from the blog https://blog.csdn.net/h106140873/article/details/103858931.

1: Create a pip folder in the root directory (I am using the root user)

mkdir ~/.pip

2: Create a pip.conf file in the .pip directory

touch pip.conf

3: Edit the pip.conf file and add the following two lines

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

Execute the pip --default-timeout=100 install docker-compose command again and the installation is successful. And the download speed is very fast

Note: Some domestic images of pip

Alibaba Cloud http://mirrors.aliyun.com/pypi/simple/
University of Science and Technology of China https://pypi.mirrors.ustc.edu.cn/simple/
Douban (douban) http://pypi.douban.com/simple/
Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/
University of Science and Technology of China http://pypi.mirrors.ustc.edu.cn/simple/

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Python pip usage timeout problem solution
  • Detailed explanation of the solution to slow, timeout, and failure of installing third-party libraries (toolkits) using pip in Python
  • How to solve the timeout during pip operation in Linux
  • Solution to timeout problem when installing Python package with PIP

<<:  vue+node+socket io realizes multi-person interaction and releases the entire process

>>:  Realize breadcrumb function based on vue-router's matched

Recommend

More Features of the JavaScript Console

Table of contents Overview console.log console.in...

Native JS to implement click number game

Native JS implements the click number game for yo...

MySQL reports an error: Can't find file: './mysql/plugin.frm' solution

Find the problem Recently, I found a problem at w...

Handwritten Vue2.0 data hijacking example

Table of contents 1: Build webpack 2. Data hijack...

JavaScript Basics: Error Capture Mechanism

Table of contents Preface Error Object throw try…...

Briefly talk about mysql left join inner join

Preface I have been busy developing a cold chain ...

9 Practical Tips for Creating Web Content Pages

Content 1. Give readers a reason to stay. Make the...

JavaScript file loading and blocking issues: performance optimization case study

Let me start with a question: When writing an HTM...

MySQL 8.0.19 installation detailed tutorial (windows 64 bit)

Table of contents Initialize MySQL Install MySQL ...

Detailed explanation of Vue3 life cycle functions and methods

1. Overview The so-called life cycle function is ...

20 CSS coding tips to make you more efficient (sorted)

In this article, we would like to share with you ...

Analysis of the difference between Mysql InnoDB and MyISAM

MySQL supports many types of tables (i.e. storage...