Retry `check_requirements` once on failure (#9466)

pull/9474/head
Glenn Jocher 10 months ago committed by GitHub
parent 5268ca14eb
commit 80c59e2461
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/utils/checks.py

@ -28,6 +28,7 @@ from ultralytics.utils import (
ONLINE, ONLINE,
ROOT, ROOT,
USER_CONFIG_DIR, USER_CONFIG_DIR,
Retry,
SimpleNamespace, SimpleNamespace,
ThreadingLocked, ThreadingLocked,
TryExcept, TryExcept,
@ -390,6 +391,7 @@ def check_requirements(requirements=ROOT.parent / "requirements.txt", exclude=()
try: try:
t = time.time() t = time.time()
assert is_online(), "AutoUpdate skipped (offline)" assert is_online(), "AutoUpdate skipped (offline)"
with Retry(times=1, delay=1): # retry once on failure after 1 second
LOGGER.info(subprocess.check_output(f"pip install --no-cache {s} {cmds}", shell=True).decode()) LOGGER.info(subprocess.check_output(f"pip install --no-cache {s} {cmds}", shell=True).decode())
dt = time.time() - t dt = time.time() - t
LOGGER.info( LOGGER.info(

Loading…
Cancel
Save