Ubuntu远程机安装YOLOX遇requirements.txt缺失错误,求解决
问题描述
在Ubuntu远程机器执行pip install yolox命令时,出现如下错误:
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/tmp/pip-install-e8uz9eo5/yolox_dd607ece87a3411aabef0d9d5bff591a/setup.py", line 77, in
install_requires=get_install_requirements(),
File "/tmp/pip-install-e8uz9eo5/yolox_dd607ece87a3411aabef0d9d5bff591a/setup.py", line 49, in get_install_requirements
with open("requirements.txt", "r", encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
[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.
解决方法
方法一:从官方源码克隆安装(推荐)
PyPI上的YOLOX包可能存在打包缺陷,直接从官方源码仓库安装更可靠:
- 克隆源码仓库:
git clone https://github.com/Megvii-BaseDetection/YOLOX.git - 进入仓库目录:
cd YOLOX - 安装依赖:
pip install -r requirements.txt - 安装YOLOX(开发模式,支持后续修改源码):
若不需要开发模式,可执行:pip install -v -e .pip install .
方法二:安装指定稳定版本
尝试安装PyPI上的历史稳定版本,部分版本的打包可能不存在该问题,例如:
pip install yolox==0.3.0
可根据实际情况尝试不同版本号。
内容的提问来源于stack exchange,提问作者Jalil Nourmohammadi Khiarak

