Skip to content

Commit d75a21b

Browse files
author
Francesco Saverio Zuppichini
authored
Silently fail to print the warning in version.download if Ultralytics not installed (#105)
* done
1 parent 1c30605 commit d75a21b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

roboflow/core/version.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import sys
44
import time
55
import zipfile
6+
from importlib import import_module
67

78
import requests
89
import wget
@@ -158,10 +159,18 @@ def download(self, model_format=None, location=None, overwrite: bool = True):
158159
self.__wait_if_generating()
159160

160161
if model_format == "yolov8":
161-
# we assume the user will want to use yolov8, for now we only support ultralytics=="8.11.0"
162-
print_warn_for_wrong_dependencies_versions(
163-
[("ultralytics", "<=", "8.0.20")]
164-
)
162+
# if ultralytics is installed, we will assume users will want to use yolov8 and we check for the supported version
163+
try:
164+
import_module("ultralytics")
165+
print_warn_for_wrong_dependencies_versions(
166+
[("ultralytics", "<=", "8.0.20")]
167+
)
168+
except ImportError as e:
169+
print(
170+
"[WARNING] we noticed you are downloading a `yolov8` datasets but you don't have `ultralytics` installed. Roboflow `.deploy` supports only models trained with `ultralytics<=8.0.20`, to intall it `pip install ultralytics<=8.0.20`."
171+
)
172+
# silently fail
173+
pass
165174

166175
model_format = self.__get_format_identifier(model_format)
167176

0 commit comments

Comments
 (0)