spirit-code / spirit

Atomistic Spin Simulation Framework
http://spirit-code.github.io
MIT License
117 stars 52 forks source link

qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" #595

Closed gwwfromcs closed 2 years ago

gwwfromcs commented 3 years ago

I tried to built Spirit on Windows 10. The compilation process is successful. But when I try to run "Spirit.exe". I got error "qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "".

I used the following for building: Visual Studio 15 2017 Win64 MSVC 2017, Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27045 for x86. cmake version 3.12.18081601-MSVC_2 Qt 5.14.1 msvc2017_64 Spirit/master commit 14ed7782bd23f4828bf23ab8136ae31a21037bb3

Is there any ideas on resolving this issue? (I google the error, and tried to add QT_QPA_PLATFORM_PLUGIN_PATH to environment variable, but not working. https://answers.ros.org/question/354707/qtqpaplugin-could-not-find-the-qt-platform-plugin-windows-in/?comment=356089#post-id-356089)

Thank you!

gwwfromcs commented 3 years ago

Instead of running "cmake --build . --config Release" in the command line, I tried to open spirit.sln with Visual Studio 2017 and build. This solves the issue.

GPMueller commented 3 years ago

If you ran it from the command line, it might have picked the wrong generator (i.e. the wrong msvc compiler version). As you managed to build after all, I suppose we can close this issue?

gwwfromcs commented 3 years ago

Instead of running "cmake --build . --config Release" in the command line, I tried to open spirit.sln with Visual Studio 2017 and build. This solves the issue.

Sorry, I was wrong. The problem is still there. I can only build and run the "DEBUG" mode of the code sucessfully. When I compile the code in the "Release" mode and run "spirit.exe", I still get the same error: qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "".

GPMueller commented 3 years ago

To me it seems like you might not have setup your PATH correctly (see https://spirit-docs.readthedocs.io/en/latest/docs/Build_Windows.html#desktop-gui).

Also, make sure that you use the correct generator. If you build Spirit for x64, but installed the x86 Qt binaries, you might be getting strange errors like this.

One more possibility: do you have conda installed on your machine? It can mess up your PATH and cause Spirit to use the wrong library folders... it has caused all kinds of weird problems for me in the past.


tried to add QT_QPA_PLATFORM_PLUGIN_PATH to environment variable

What exactly did you do? I myself don't know how one would do this correctly on Windows.


When I compile the code in the "Release" mode

You are doing this by selecting "Release" in the build-type dropdown in Visual Studio or how exactly?

gwwfromcs commented 3 years ago

If you build Spirit for x64, but installed the x86 Qt binaries, you might be getting strange errors like this.

I checked and made sure I used x64 for both.

One more possibility: do you have conda installed on your machine?

Yes, I have anaconda installed.

You are doing this by selecting "Release" in the build-type dropdown in Visual Studio or how exactly?

Yes, I did this by selecting "Release" in the dropdown menu of Visual Studio.

GPMueller commented 3 years ago

Yes, I have anaconda installed.

Please check your Windows PATH and make sure that your Qt directories appear before any Anaconda directories. It might be that your executable is picking up Qt libraries from the wrong folder, which in turn are not able to find the corresponding plugins for some reason.

PS: Qt on Windows can be a bit annoying, at some point the Qt GUI will be replaced with an ImGui one, which won't have issues like this.

gwwfromcs commented 3 years ago

Please check your Windows PATH and make sure that your Qt directories appear before any Anaconda directories. It might be that your executable is picking up Qt libraries from the wrong folder, which in turn are not able to find the corresponding plugins for some reason.

Thanks for your suggestion. I will try this on Windows. I've also installed Spirit successfully on a Linux machine.

GPMueller commented 3 years ago

Dear @gwwfromcs did it solve your problem?

gwwfromcs commented 3 years ago

Sorry, I'm not trying anymore tests on Windows. I'm now using Spirit on Linux.

GPMueller commented 2 years ago

I will close this issue as, to my knowledge, there hasn't been others observing this issue.

@gwwfromcs note that since beginning of November the new ImGUI app on the develop branch is working quite well. It doesn't come with all the Qt issues, please feel free to give it a try (just use SPIRIT_UI_USE_IMGUI=ON, as described in the docs).