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

【已解决】macOS中pip恢复安装库报错:ERROR Could not find a version that satisfies the requirement pbr from versions none

macOS crifan 753浏览 0评论
折腾:
【未解决】Win中VMWare中macOS初始化项目代码调试环境
期间,用pip恢复安装之前的库,结果报错:
(venv)  crifanli@crifanlideMac  ~/dev/DevRoot/appcrawler   master  pip install -r requirements.txt
Looking in indexes: http://pypi.mirrors.ustc.edu.cn/simple/
Collecting adbutils==0.7.1
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/f2/80/751fa9061215ca192bddbadc6ca6f048b28b5d2998895025dae77a3b410c/adbutils-0.7.1.tar.gz (153 kB)
     |████████████████████████████████| 153 kB 1.9 MB/s
    ERROR: Command errored out with exit status 1:
     command: /Users/crifanli/dev/DevRoot/appcrawler/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/v1/7j6bkrx95nz239_l7q6p37440000gn/T/pip-install-71lbj7rx/adbutils/setup.py'"'"'; __file__='"'"'/private/var/folders/v1/7j6bkrx95nz239_l7q6p37440000gn/T/pip-install-71lbj7rx/adbutils/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/v1/7j6bkrx95nz239_l7q6p37440000gn/T/pip-pip-egg-info-q3th5uz5
         cwd: /private/var/folders/v1/7j6bkrx95nz239_l7q6p37440000gn/T/pip-install-71lbj7rx/adbutils/
    Complete output (33 lines):
    WARNING: The repository located at pypi.mirrors.ustc.edu.cn is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.mirrors.ustc.edu.cn'.
    ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
    ERROR: No matching distribution found for pbr
    Traceback (most recent call last):
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/Users/crifanli/.pyenv/versions/3.8.3/lib/python3.8/subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/Users/crifanli/dev/DevRoot/appcrawler/venv/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/v1/7j6bkrx95nz239_l7q6p37440000gn/T/tmppw53yveq', '--quiet', 'pbr']' returned non-zero exit status 1.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/v1/7j6bkrx95nz239_l7q6p37440000gn/T/pip-install-71lbj7rx/adbutils/setup.py", line 11, in <module>
        setuptools.setup(setup_requires=['pbr'], python_requires='>=3.5', pbr=True)
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 160, in setup
        _install_setup_requires(attrs)
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 155, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/setuptools/dist.py", line 695, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 781, in resolve
        dist = best[req.key] = env.best_match(
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1066, in best_match
        return self.obtain(req, installer)
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1078, in obtain
        return installer(requirement)
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/Users/crifanli/dev/DevRoot/appcrawler/venv/lib/python3.8/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/Users/crifanli/dev/DevRoot/appcrawler/venv/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/v1/7j6bkrx95nz239_l7q6p37440000gn/T/tmppw53yveq', '--quiet', 'pbr']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
(venv)  ✘ crifanli@crifanlideMac  ~/dev/DevRoot/appcrawler   master 
看起来也很奇怪
此处最开始的
Looking in indexes: http://pypi.mirrors.ustc.edu.cn/simple/
是从,我们希望的,最新的pip源,ustc去找了
但是后面的
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/f2/80/751fa9061215ca192bddbadc6ca6f048b28b5d2998895025dae77a3b410c/adbutils-0.7.1.tar.gz (153 kB)
却是从 tsinghua 去下载的。。。
不过此处重点不是这里,而是报错
    ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
    ERROR: No matching distribution found for pbr
所以,先去搜搜
pip     ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
python – ‘pip install’ fails for every package (“Could not find a version that satisfies the requirement”) – Stack Overflow
担心是 源 错乱了导致的。
所以感觉还是先去解决之前的:
【未解决】macOS中全局设置pip源是ustc但是当前项目却从tsinghua的源去安装
等排除了源的问题后,再回来解决此问题,会比较好。
后来注意到了:
    WARNING: The repository located at pypi.mirrors.ustc.edu.cn is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.mirrors.ustc.edu.cn'.
像是:
此处把ustc忽略了,导致后续无法安装在
前面重启了。现在恢复虚拟机,继续运行
去搜搜
pip WARNING: The repository located at is not a trusted or secure host and is being ignored
解决 pip 设置镜像时遇到的 warning – 简书
此处感觉核心在于解决:
找到当前项目,本地pip,的源 在哪里设置了Tsinghua
因为之前已经设置了全局的pip的源
➜  ~ cat ~/.pip/pip.conf
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.mirrors.ustc.edu.cn
[global]
# index-url = http://pypi.douban.com/simple
index-url = http://mirrors.aliyun.com/pypi/simple/
但是现在最新的pip要求源必须是https的,不然会报错:
“The repository located at http://mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with ‘–trusted-host mirrors.aliyun.com’.”
加上:
trusted-host = mirrors.aliyun.com
即可。
但是此处已经加上了。
pip源提示“not a trusted or secure host” 解决 – Yemilice – 博客园
算了,当前项目找不到当前的pip源配置
去找找,原始的项目的代码中,哪里设置了Tsinghua的源
要换去Mac中找找
没找到有哪里pip相关的
突然想到了,退出venv虚拟环境,系统全局pip去安装别的库,比如requests试试
✘ crifanli@crifanlideMac  ~  pip install requests
Looking in indexes: http://pypi.mirrors.ustc.edu.cn/simple/
Collecting requests
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 273 kB/s
Collecting certifi>=2017.4.17
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
     |████████████████████████████████| 156 kB 1.6 MB/s
Collecting idna<3,>=2.5
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 5.0 MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
     |████████████████████████████████| 126 kB 1.3 MB/s
Collecting chardet<4,>=3.0.2
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 3.7 MB/s
Installing collected packages: certifi, idna, urllib3, chardet, requests
Successfully installed certifi-2020.6.20 chardet-3.0.4 idna-2.9 requests-2.24.0 urllib3-1.25.9
结果:问题依旧。
显示是从
Looking in indexes: http://pypi.mirrors.ustc.edu.cn/simple/
去查找,但是真正是从
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-
去下载和安装的。
难道是:
ustc的竟然内部已经跳转到tsinghua了??
之前貌似有这个新闻听说过这(个奇怪)的事情的?
去看看
http://pypi.mirrors.ustc.edu.cn/simple/
竟然无法打开。。。
去看看
https://mirrors.tuna.tsinghua.edu.cn/pypi/
速度很快,没问题。
去搜索新闻
pip 镜像 ustc 跳转 tsinghua
突然发现中科大的 pypi 源跳转到了清华 – V2EX
2019-05-22
之前就出现了,别人也发现了的
pypi | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
那看来真的是这个问题了。
所以,去修改全局的pip的配置,把源彻底换为清华的:
参考自己的
【已解决】macOS中pip安装powerline-status报错:WARNING Retrying Retry total 4 after connection broken by ConnectTimeoutError
去改为:
crifanli@crifanlideMac  ~  vi ~/.pip/pip.conf
✘ crifanli@crifanlideMac  ~  cat ~/.pip/pip.conf
[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
再去安装一个别的啥库试试
crifanli@crifanlideMac  ~  pip install flask
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting flask
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94 kB)
     |████████████████████████████████| 94 kB 1.2 MB/s
Collecting Jinja2>=2.10.1
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
     |████████████████████████████████| 125 kB 2.6 MB/s
Collecting itsdangerous>=0.24
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting Werkzeug>=0.15
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
     |████████████████████████████████| 298 kB 795 kB/s
Collecting click>=5.1
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82 kB)
     |████████████████████████████████| 82 kB 1.4 MB/s
Collecting MarkupSafe>=0.23
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0c/12/37f68957526d1ec0883b521934b4e1b8ff3dd8e4fab858a5bf3e487bcee9/MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl (16 kB)
Installing collected packages: MarkupSafe, Jinja2, itsdangerous, Werkzeug, click, flask
Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.2 flask-1.1.2 itsdangerous-1.1.0
即可正常,至少不会出现 ustc的源 和 tsinghua的源,混乱的问题了。
再回去试试前面的
pip install -r requirements.txt
结果:
(venv)  crifanli@crifanlideMac  ~/dev/DevRoot/appcrawler   master  pip install -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting adbutils==0.7.1
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f2/80/751fa9061215ca192bddbadc6ca6f048b28b5d2998895025dae77a3b410c/adbutils-0.7.1.tar.gz (153 kB)
     |████████████████████████████████| 153 kB 1.4 MB/s
Collecting apkutils2==1.0.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e5/d0/432fb6fb1fe48aa0ea1c80e8dec4a26f70c868999c076f92af88582ae91a/apkutils2-1.0.0.tar.gz (60 kB)
     |████████████████████████████████| 60 kB 4.5 MB/s
继续
貌似没问题了
【总结】
此次,之前用:
pip install -r requirements.txt
报错:
    WARNING: The repository located at pypi.mirrors.ustc.edu.cn is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.mirrors.ustc.edu.cn'.
    ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
    ERROR: No matching distribution found for pbr
原因:
新的pip的源
pypi.mirrors.ustc.edu.cn
不受信任,从而相当于没有pip的源,导致报错,找不到库,无法下载。
解决办法:
直觉处理方式是:给
pypi.mirrors.ustc.edu.cn
加上信任即可。
但是实际上此处比较特殊:
之前已设置的全局的pip配置是:
➜  ~ cat ~/.pip/pip.conf
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.mirrors.ustc.edu.cn
按道理,是没问题的。
但是由于此处的ustc的pip的源
http://pypi.mirrors.ustc.edu.cn/simple/
(此处浏览器已打不开了)
内部跳转到了清华的源了
-》导致实际下载库,是从清华的源的地址去下载的:
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/f2/80/751fa9061215ca192bddbadc6ca6f048b28b5d2998895025dae77a3b410c/adbutils-0.7.1.tar.gz (153 kB)
总之是错乱了。
所以,此处的真正的解决办法是:
放弃ustc的源,完整的改用清华的源:
✘ crifanli@crifanlideMac  ~  cat ~/.pip/pip.conf
[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恢复安装库报错:ERROR Could not find a version that satisfies the requirement pbr from versions none

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
91 queries in 0.270 seconds, using 23.44MB memory