error in qpth setup command: ‘install_requires‘ must be a string or list of strings 解决方案

问题描述

今天在执行pip install qpth时,遇到了以下bug:

$ pip install qpth
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting qpth
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e1/d5/cb0aefa287767726e6e20b0b3774517feaaca11c775c0069824b4c68d1e8/qpth-0.0.15.tar.gz (11 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      error in qpth setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
          numpy>=1<2
               ~~~^
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

这说明qpth的setup.py写的有问题。博主本来想找到下载下来的tar.gz解包后再修改的,奈何执行全局搜索也没有找到qpth相关的包,执行

conda run python -m pip cache dir

返回/root/.cache/pip,在这个文件夹里也没有找到。决定按照报错提供的链接地址下载后上传至服务器,修改setup.py后手动pip。

解决方案

下载链接:

https://pypi.tuna.tsinghua.edu.cn/packages/e1/d5/cb0aefa287767726e6e20b0b3774517feaaca11c775c0069824b4c68d1e8/qpth-0.0.15.tar.gz

将该压缩包上传至服务器并使用以下命令解压缩:

tar -vxzf qpth-0.0.15.tar.gz

进入该文件夹,打开setup.py文件,将报错中的

numpy>=1<2

改为

numpy>=1

然后执行

python setup.py install

成功安装qpth。 

参考链接

https://www.saoniuhuo.com/question/detail-2665945.html

Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [84 lines of output] C:\ProgramData\mambaforge\lib\site-packages\setuptools\dist.py:476: SetuptoolsDeprecationWarning: Invalid dash-separated options !! ******************************************************************************** Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details. ******************************************************************************** !! opt = self.warn_dash_deprecation(opt, section) C:\ProgramData\mambaforge\lib\site-packages\setuptools\dist.py:476: SetuptoolsDeprecationWarning: Invalid dash-separated options !! ******************************************************************************** Usage of dash-separated 'author-email' will not be supported in future versions. Please use the underscore name 'author_email' instead. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details. ******************************************************************************** !! opt = self.warn_dash_deprecation(opt, section) C:\ProgramData\mambaforge\lib\site-packages\setuptools\dist.py:476: SetuptoolsDeprecationWarning: Invalid dash-separated options !! ******************************************************************************** Usage of dash-separated 'home-page' will not be supported in future versions. Please use the underscore name 'home_page' instead. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details. ******************************************************************************** !! opt = self.warn_dash_deprecation(opt, section) C:\ProgramData\mambaforge\lib\site-packages\setuptools\__init__.py:81: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. !! ******************************************************************************** Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try `pip install --use-pep517`. ******************************************************************************** !! dist.fetch_build_eggs(dist.setup_requires) C:\ProgramData\mambaforge\lib\site-packages\setuptools\command\develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` and ``easy_install``. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://github.com/pypa/setuptools/issues/917 for details. ******************************************************************************** !! easy_install.initialize_options(self) C:\ProgramData\mambaforge\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() error in setup command: 'tests_require' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier) pytz>=2010h ~~~~~~^ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip.
最新发布
07-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值