I encountered the same problem.
My packaging command is:
pyinstaller -F --noconfirm --onedir --console --add-data "testdata;testdata/" --hiddenimport="utils.general" --collect-binaries "utils.general" "detect.py"