glenn-jocher
commited on
Commit
•
9f3a388
1
Parent(s):
ee24ae1
Improved check_requirements() robustness (#3298)
Browse filesAdd try: except clause on missing requirements install to catch install failures. Prompted by Ultralytics YOLOv5 API failure on Cython.
- utils/general.py +4 -1
utils/general.py
CHANGED
@@ -137,7 +137,10 @@ def check_requirements(requirements='requirements.txt', exclude=()):
|
|
137 |
except Exception as e: # DistributionNotFound or VersionConflict if requirements not met
|
138 |
n += 1
|
139 |
print(f"{prefix} {r} not found and is required by YOLOv5, attempting auto-update...")
|
140 |
-
|
|
|
|
|
|
|
141 |
|
142 |
if n: # if packages updated
|
143 |
source = file.resolve() if 'file' in locals() else requirements
|
|
|
137 |
except Exception as e: # DistributionNotFound or VersionConflict if requirements not met
|
138 |
n += 1
|
139 |
print(f"{prefix} {r} not found and is required by YOLOv5, attempting auto-update...")
|
140 |
+
try:
|
141 |
+
print(subprocess.check_output(f"pip install '{r}'", shell=True).decode())
|
142 |
+
except Exception as e:
|
143 |
+
print(f'{prefix} {e}')
|
144 |
|
145 |
if n: # if packages updated
|
146 |
source = file.resolve() if 'file' in locals() else requirements
|