Skip to content

Commit

Permalink
Check_requirements() enclosing apostrophe bug fix (ultralytics#2929)
Browse files Browse the repository at this point in the history
This fixes a bug where the '>' symbol in python package requirements was not running correctly with subprocess.check_output() commands.

(cherry picked from commit 1849916)
  • Loading branch information
glenn-jocher authored and Lechtr committed Apr 28, 2021
1 parent 6a92926 commit 7209319
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def check_requirements(requirements='requirements.txt', exclude=()):
pkg.require(r)
except Exception as e: # DistributionNotFound or VersionConflict if requirements not met
n += 1
print(f"{prefix} {e.req} not found and is required by YOLOv5, attempting auto-update...")
print(subprocess.check_output(f"pip install {e.req}", shell=True).decode())
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())

if n: # if packages updated
source = file.resolve() if 'file' in locals() else requirements
Expand Down

0 comments on commit 7209319

Please sign in to comment.