Tag not monitored by Microsoft.
The error indicates that the QtWidgets DLLs required by PyQt6 cannot be found when the frozen (PyInstaller) app runs.
Use these steps to fix it:
- Verify PyQt6 is installed in the environment used to build
- In the build environment run:
python -m pip show PyQt6 - If missing, install it:
python -m pip install --upgrade PyQt6
- In the build environment run:
- Rebuild with PyInstaller including PyQt6 plugins and DLLs
- If using a
.specfile, ensurePyQt6is collected:from PyInstaller.utils.hooks import collect_all datas, binaries, hiddenimports = collect_all("PyQt6") a = Analysis( ["main.py"], ..., datas=datas, binaries=binaries, hiddenimports=hiddenimports, ) - If using the command line, try:
pyinstaller --onefile --noconsole main.py --hidden-import PyQt6.QtWidgets - After rebuilding, run the generated EXE on the same machine to confirm it starts.
- If using a
- Check for missing runtime dependencies on the target machine
- Ensure the same (or compatible) Microsoft Visual C++ runtime is installed as on the build machine. Missing VC++ runtimes commonly cause Qt DLLs to fail to load.
- Install the appropriate Visual C++ Redistributable (matching the Python/PyQt6 build) on the target system.
- Confirm all Qt DLLs are present next to the EXE
- In the
dist/<appname>folder, there should be:-
PyQt6package directory -
Qt6*.dllfiles -
platforms,styles, and other Qt plugin folders
-
- If they are missing, adjust the PyInstaller spec as in step 2 to collect them.
- In the
- Test on a clean machine
- Copy the entire
dist/<appname>directory to a clean Windows machine and run the EXE. - If it fails only there, a missing system dependency (e.g., VC++ runtime) is the likely cause.
- Copy the entire
If the problem persists, rebuild with a fresh virtual environment, reinstall PyQt6, regenerate the PyInstaller spec, and rebuild to ensure no stale paths or partial installs.
References: