Search code examples
pythonpytorchpyinstalleryoloyolov8

Yolov8 Pyinstaller exe file constantly reruns itself


I converted a very simple application that I developed with Yolov8 to exe with pyinstaller. The script runs very well but when I run the exe file it constantly reruns itself. My codes are as follows:

from ultralytics import YOLO

model = YOLO("best.pt")
results = model.track("./last.mp4", show=True)

Error Image

Pyinstaller command to convert it to exe file:

pyinstaller main.py --no-console

Additional note:
After converting the script to an exe file, I manually created the ultralytics/cfg/default.yaml file at the location of the exe file because it gave an error that ultralytics could not find the default.yaml file.

I also tried converting into onefile but still it doesn't work.


Solution

  • I discovered that the issue is related to the 'cpuinfo' module. I don't yet know the reason, but removing the relevant code from the Ultralytics codebase resolved the problem.