Pip install Read timed out error

Error: pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out 

Reasons:

  • the network speed is slow, which caused by instability
  • the default installation source for some libraries is pip the default source is pypi.python.org, if the server that installs the source is not in the country, it will be restricted

Solutions:(https://www.codestudyblog.com/cs2112pyb/1214135027.html)

1 change settings pip installation extension time
  • pip --default-timeout=100 install -U  library name 

2 change the mirror image

replace the use of domestic images during pip installation , general use of tsinghua university 、 these two images of douban

tsinghua mirror image :

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  library name 
douban image :

pip install -i http://pypi.douban.com/simple  library name 
  domestic commonly used mirror images


3 set up proxy

pip installation by setting up an agent

pip install --proxy  proxy library name 

for example :
pip install -i http://pypi.douban.com/simple  --proxy http://10.22.96.13:8008 jupyter


4 modify pip change the source of the configuration file

by modifying the pip configuration , to change the default source to a domestic one, we only need the simplest command. "pip config set global.index-url source link " that's it. for example, replace it with tsinghua source. :

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/

No comments:

Post a Comment