Unverified 提交 9f3a388c authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Improved check_requirements() robustness (#3298)

Add try: except clause on missing requirements install to catch install failures. Prompted by Ultralytics YOLOv5 API failure on Cython.
上级 ee24ae11
...@@ -137,7 +137,10 @@ def check_requirements(requirements='requirements.txt', exclude=()): ...@@ -137,7 +137,10 @@ def check_requirements(requirements='requirements.txt', exclude=()):
except Exception as e: # DistributionNotFound or VersionConflict if requirements not met except Exception as e: # DistributionNotFound or VersionConflict if requirements not met
n += 1 n += 1
print(f"{prefix} {r} not found and is required by YOLOv5, attempting auto-update...") print(f"{prefix} {r} not found and is required by YOLOv5, attempting auto-update...")
print(subprocess.check_output(f"pip install '{r}'", shell=True).decode()) try:
print(subprocess.check_output(f"pip install '{r}'", shell=True).decode())
except Exception as e:
print(f'{prefix} {e}')
if n: # if packages updated if n: # if packages updated
source = file.resolve() if 'file' in locals() else requirements source = file.resolve() if 'file' in locals() else requirements
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论