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

How to completely uninstall iis7 web and ftp services in win7

After I set up the PHP development environment on...

Docker installs mysql and solves the Chinese garbled problem

Table of contents 1. Pull the mysql image 2. Chec...

A Brief Analysis of CSS Selector Grouping

Selector Grouping Suppose you want both the h2 el...

Linux tac command implementation example

1. Command Introduction The tac (reverse order of...

How to use vue-video-player to achieve live broadcast

Table of contents 1. Install vue-video-player 2. ...

Html+CSS floating advertisement strip implementation

1.html part Copy code The code is as follows: <...

mysql indexof function usage instructions

As shown below: LOCATE(substr,str) Returns the fi...

The process of using vxe-table to make editable tables in vue

There is a table in the project that needs to be ...

Windows10 mysql 8.0.12 non-installation version configuration startup method

This article shares the specific steps for config...

Detailed tutorial on building an ETCD cluster for Docker microservices

Table of contents Features of etcd There are thre...

How to use translate and transition in CSS3

I always feel that translate and transition are v...

How to install and configure the Apache Web server

Learn how to host your own website on Apache, a r...

Thinking about grid design of web pages

<br />Original address: http://andymao.com/a...

A brief discussion on React Component life cycle functions

What are the lifecycle functions of React compone...

MySQL 8.0 can now handle JSON

Table of contents 1. Brief Overview 2. JSON basic...