最新消息:20210917 已从crifan.com换到crifan.org

【已解决】macOS中pip安装powerline-status报错:WARNING Retrying Retry total 4 after connection broken by ConnectTimeoutError

macOS crifan 653浏览 0评论
折腾:
【未解决】Win的VMWare的macOS中安装iTerm2并添加主题和插件
期间,Win中VMWare的macOS中
去用pip安装库结果报错:
➜  ~ pip install powerline-status --user
Collecting powerline-status
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x106c18130>, 'Connection to 
pypi.org
 timed out. (connect timeout=15)')': /simple/powerline-status/
结果是连接pypi.org速度太慢,超时了
过了会,最终超时停止了:
➜  ~ pip install powerline-status --user
Collecting powerline-status
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x106c18130>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/powerline-status/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x106c18100>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/powerline-status/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x106c184c0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/powerline-status/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x106c18400>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/powerline-status/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x106c182e0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/powerline-status/
  ERROR: Could not find a version that satisfies the requirement powerline-status (from versions: none)
ERROR: No matching distribution found for powerline-status
macos pip   WARNING: Retrying (Retry(total=4, connect=None
其是通过更换源,速度快
那就希望全局更换pip的源为中科大
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=’pypi.org‘, port=443): Read timed out. (read timeout=15)”)’: /simple/flask-bcrypt/ · Issue #7424 · pypa/pip
macos change pip source
看起来是:
$HOME/.pip/pip.conf
  • Windows:C:\Users\Administrator\pip\pip.ini
  • macOS:~/.pip/pip.conf
内容为:
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.mirrors.ustc.edu.cn
去试试
➜  ~ vi ~/.pip/pip.conf
➜  ~ mkdir ~/.pip
➜  ~ vi ~/.pip/pip.conf
➜  ~ cat ~/.pip/pip.conf
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.mirrors.ustc.edu.cn
然后(发现无需重启终端),再去pip安装试试
速度暴快:
➜  ~ pip install powerline-status --user
Looking in indexes: http://pypi.mirrors.ustc.edu.cn/simple/
Collecting powerline-status
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/9c/30/8bd3c62642778af9ad813a526c6ff7dd2f98144d6580ad6fab94ca389265/powerline-status-2.7.tar.gz (233kB)
     |████████████████████████████████| 235kB 1.4MB/s
Installing collected packages: powerline-status
  Running setup.py install for powerline-status ... done
Successfully installed powerline-status-2.7
WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
【总结】
此处,macOS用pip安装库:
pip install powerline-status --user
而报错:
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x106c18130>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/powerline-status/
原因:pip安装的库都是放在官网pypi.org中的,国内连接速度太慢,所以报超时的错。
解决办法:更换速度快的国内的源,比如中科大的
步骤:
(1)新建一个,系统的全局的pip的配置文件
逻辑是:
放在系统用户目录下的pip的配置文件
具体说就是:
  • Windows:%HOMEPATH%\pip\pip.ini
    • 举例
      • C:\Users\Administrator\pip\pip.ini
  • macOS:~/.pip/pip.conf
    • 举例
      • /Users/crifanli/.pip/pip.conf
所以此处macOS去:
mkdir ~/.pip
vi ~/.pip/pip.conf
然后输入内容:
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.mirrors.ustc.edu.cn
其中,上述是中科大的源,可以根据自己需要换其他的源:
(1)清华大学的pip的源
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
(2)阿里云的pip的源
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
(3)豆瓣的pip的源
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
然后再去pip的install,速度暴快,此处> 1MB/s,效果很爽。
【后记 20200623】
不要用ustc的pip源,建议换用:清华的
[global]
#index-url = http://pypi.mirrors.ustc.edu.cn/simple/
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
#trusted-host=pypi.mirrors.ustc.edu.cn
trusted-host=pypi.tuna.tsinghua.edu.cn
详见:
【已解决】macOS中全局设置pip源是ustc但是当前项目却从tsinghua的源去安装

转载请注明:在路上 » 【已解决】macOS中pip安装powerline-status报错:WARNING Retrying Retry total 4 after connection broken by ConnectTimeoutError

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.187 seconds, using 23.40MB memory