-
Notifications
You must be signed in to change notification settings - Fork 94
Description
Description
When attempting to download a dataset using Roboflow's Python package, an ImportError
occurs due to a dependency version mismatch with the ultralytics
package.
Steps to Reproduce
Click on custom train option and execute recommended code using Roboflow's API:
from roboflow import Roboflow
rf = Roboflow(api_key="MY_API_KEY")
project = rf.workspace("myworkspace").project("myproject")
version = project.version(1)
dataset = version.download("yolov8")
Expected Behavior
The dataset should download without any issues, and the script should handle dependencies smoothly, even with newer versions of ultralytics.
Actual Behavior
The script throws an ImportError, stating a dependency version mismatch:
loading Roboflow workspace...
Dependency ultralytics==8.0.196 is required but found version=8.2.2, to fix: `pip install ultralytics==8.0.196`
Proposed Solution
It would be beneficial for compatibility and future-proofing to support newer versions of ultralytics or at least allow the downloading with a version warning. If possible, updating the dependency requirements or making the version checks more flexible could resolve this issue.
Temporary solution
I added the ask_to_continue
argument and set it to True
in Version.download
method:
...
if model_format == "yolov8":
# if ultralytics is installed, we will assume users will want to use yolov8 and we check for the supported version # noqa: E501 // docs
try:
import_module("ultralytics")
print_warn_for_wrong_dependencies_versions([("ultralytics", "==", "8.0.196")], ask_to_continue=True)
except ImportError:
print(
"[WARNING] we noticed you are downloading a `yolov8` datasets but you don't have `ultralytics` installed. " # noqa: E501 // docs
"Roboflow `.deploy` supports only models trained with `ultralytics==8.0.196`, to intall it `pip install ultralytics==8.0.196`." # noqa: E501 // docs
)
# silently fail
pass
...
loading Roboflow workspace...
loading Roboflow project...
Dependency ultralytics==8.0.196 is required but found version=8.2.2, to fix: `pip install ultralytics==8.0.196`
Would you like to continue with the wrong version of ultralytics? y/n: y
Dataset is downlaoded
Additional Information
Python Version: 3.10
Operating System: Windows 10
ultralytics Version: 8.2.2
Thanks :)