Problem about Qt: Could not find the Qt platform plugin "windows" in ""

When I try to visualize the detector geometry with Qt, I got an error about Qt, as shown below:

qt.qpa.plugin: Could not find the Qt platform plugin “windows” in “”
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

I have searched for this error on the web. One solution is to set an environment variable QT_PLUGIN_PATH = pathto\Qt\5.15.2\msvc2019_64\plugins. This makes it work. Qt was initialized successfully. But some other programs went wrong because of the environment variable QT_PLUGIN_PATH. I have to delete the environment variable QT_PLUGIN_PATH to ensure other programs based on Qt function well.

This application failed to start because no Qt platform plugin could be initialized Reinstalling the application may fix this problem. (This error is given by another program based on Qt after the environment variable QT_PLUGIN_PATH was set.)

I want to know what is wrong with my GEANT4 installation. I never met this problem before. Neither 10.7 on windows 11 with VS 2022 and Qt 5.15 nor 11.0 on windows 10 with VS 2022 and Qt 5.12.

Qt Version: 5.15.2
Geant4 Version: 11.1.2
Operating System: Windows 11 22H2
Compiler/Version: Visual Studio 2022
CMake Version: 3.27.4


Since there is no answer… We can try a workaround. I am not familiar with installations in windows. However, I have seen the Linux subsystem of Windows working pretty well. The instructions to install the WLS have change, now it looks simpler :slight_smile:

After installing the Linux subsystem you will have a native Linux virtual machine (ubuntu22 or other distribution). To enable visualization you may an X server like XMing (or other).

Since the environment is empty, you may need to install a number of packages. The metapackage ‘HEP OS lib’ takes care of it. The recipe for Ubuntu22,

  sudo apt-get install ./heposlibs_8.1.2-1.focal_amd64.deb  

For other distros, check the main page.

I have a similar problem with Alma9, caused by a mismatch in the version of Qt5 packages (some are 5.12 and some 5.15). I have not found a nice solution to that yet.


Thanks for your reply.
I found another potential solution. Setting environment variable QT_QPA_PLATFORM_PLUGIN_PATH = pathto\Qt\5.15.2\msvc2019_64\plugins\platforms instead of QT_PLUGIN_PATH = pathto\Qt\5.15.2\msvc2019_64\plugins might fix this problem without causing any other errors.

Great! If you manage to solve the issue, it would be great if you could post the steps you followed :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.