Actually, the link you posted in the past received a new answer in Aug 2024. This one: https://stackoverflow.com/a/78876788/9151070
The suggestion is to use --collect-datas=fake_useragent
in the pyinstaller. I was facing the same issue as you and this suggestion fixed it. Example:
pyinstaller --collect-datas=fake_useragent --onefile -w my_project.py