Yolov8 is build to run with 3.8 or above and pip install ultralytics
is not compatible with prior versions.
I have the constraint of using a prior version of Python to execute the code on a microcomputer like Jetson Nano or Jetson Xavier.
I've seen on many issues of Yolov8 repository people asking how to solve this issue aswell.
I'll answer bellow, the solution I have found so that others can benefit it or improve it.
First start by cloning the ultralytics repository git clone https://github.com/ultralytics/ultralytics.git
into your lib folder.
Then do the following modifications:
import importlib.metadata
line 4
replace it by import pkg_resources
importlib.metadata.version("torchvision")
by TORCHVISION_VERSION = pkg_resources.get_distribution("torchvision").version
line 47This is because importlib.metadata is not present in python 3.6
import importlib.metadata
line 13if header := self.get_auth_header():
line 93 byheader = self.get_auth_header() if header:
This is because the walrus operator is not present in python 3.6
This might break some things in the way yolov8 is working. But from what I have tested it is sufficient to run the predictions.