From 71f78a62b3a19fd4577b93f5a03247bb4faf8c72 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 14 Jul 2023 13:23:13 +0200 Subject: [PATCH] Fix `check_requirements()` console output (#3738) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- ultralytics/yolo/utils/checks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ultralytics/yolo/utils/checks.py b/ultralytics/yolo/utils/checks.py index 5908d3b..427a175 100644 --- a/ultralytics/yolo/utils/checks.py +++ b/ultralytics/yolo/utils/checks.py @@ -223,7 +223,7 @@ def check_requirements(requirements=ROOT.parent / 'requirements.txt', exclude=() requirements = [requirements] s = '' # console string - n = 0 # number of packages updates + pkgs = [] for r in requirements: rmin = r.split('/')[-1].replace('.git', '') # replace git+https://org/repo.git -> 'repo' try: @@ -234,11 +234,11 @@ def check_requirements(requirements=ROOT.parent / 'requirements.txt', exclude=() importlib.import_module(next(pkg.parse_requirements(rmin)).name) except ImportError: s += f'"{r}" ' - n += 1 + pkgs.append(r) if s: if install and AUTOINSTALL: # check environment variable - pkgs = file or requirements # missing packages + n = len(pkgs) # number of packages updates LOGGER.info(f"{prefix} Ultralytics requirement{'s' * (n > 1)} {pkgs} not found, attempting AutoUpdate...") try: t = time.time()