I am investigating extremely slow start of a python3 script running on Raspberry Pie and nailed it down to Qt QApplication constructor. To confirm, I have created TestQt.py:
from sys import argv
from PyQt5.QtWidgets import QApplication
app = QApplication(argv)
It takes 45-49 seconds to execute, e.g.
pi@raspberrypi:~/test-dir $ time python3 TestQt.py
real 0m48.973s
user 0m0.394s
sys 0m0.106s
While it starts, top shows very low CPU consumption. I have no idea what can be the cause. Any ideas, please?
Edit: as suggested in a comment by three_pineapples:
Raspbian GNU/Linux 10 (buster)
Python 3.7.3
PyQt version: 5.11.3
Qt version: 5.11.3
Edit2: as suggested in a comment by samdavydov:
Raspberry Pi 3 Model B Plus Rev 1.3
As suggested on another forum, it may be related to connecting over ssh -X. I am connecting to the device remotely, so I can not confirm that. However, afterwards it can repaint its (graphics-rich) window in definitely less than 1 second, so it does not look like a bandwidth issue. As far as I know, it has no physical display connected. Could that be a reason?
Edit3: I have finally got a device delivered to my desk and the problem is gone. It seems it was caused by VPN communication. Having another display connected directly to the device or not does not make a difference.