0

I'm running a python function in Matlab and when I run I got the error:

This application failed to start because it could not find or load the Qt plataform plugin 'windows' in '' '' , Available plugins are: minimal offscreen, windows. Reinstalling the application may fix this problem.

I already followed the steps in this video copying the platform folder to pyqt tools and in this post add to the environment path. If I run my code in python it works fine, It seems that Matlab is not finding the Qt platform plugin 'Windows' Someone can help me, please?

JCV
  • 447
  • 1
  • 5
  • 15

2 Answers2

0

This is the problem of deploying Qt applications. Depending on platform you're using you can find tool for deploying, it is in Qt directory. For example, on my PC with Windows this is:

c:\Qt\5.15.0\mingw81_64\bin\windeployqt.exe

You can call this tool like this:

windeployqt <path-to-app-binary>
//  OR
windeployqt --qmldir  <path-to-app-qml-files>  <path-to-app-binary>

There are many other options like --debug, --release, etc. Too see all of them, just call windeployqt.

On other platforms it could be linuxdeployqt, macdeployqt, also pyqtdeploy.

After calling this tool it will copy all required submodules to (near) your app, so it will find all it needs.

Ihor Drachuk
  • 1,265
  • 7
  • 17
  • Probably, in your case you need `pyqtdeploy`, see https://pypi.org/project/pyqtdeploy/ – Ihor Drachuk Jul 30 '20 at 00:25
  • I found the place where I have this windeployqt, and now? what I should do? I have in C:\ProgramData\Anaconda3\envs\SimPEG1401\Library\bin\windeployqt.exe – JCV Jul 30 '20 at 00:25
  • I assume you should call deploy tool specifying path to Qt app – Ihor Drachuk Jul 30 '20 at 00:28
  • and which one I call? debug? – JCV Jul 30 '20 at 00:32
  • Depends on built type of app. Also you can try not specifying it. – Ihor Drachuk Jul 30 '20 at 07:54
  • I have tried without specifying, doesn't work...I have tried this command : windeployqt --dir <'C:\Users\code'> but gives an error : The syntax of the command is incorrect. Do you know how should I do? – JCV Jul 30 '20 at 21:04
  • If it didn't help, then I don't know what can, unfortunately. Maybe this is specific of Python or PyQt, but I am not very strong at these technologies – Ihor Drachuk Jul 30 '20 at 21:16
0

On my Windows system, I had the same experience that the Python function ran natively, but would not run via MATLAB. The problem was missing or incompatible dlls (not exe) files. To solve the problem I copied the exact dlls from my conda environment into the MATLAB \bin\win64 folder. That is, I copied these five dlls

  • qdirect2d.dll
  • qminimal.dll
  • qoffscreen.dll
  • qwebgl.dll
  • qwindows.dll

from the \Library\plugins\platforms folder of my conda environment

C:\Users\username\AppData\Local\Continuum\envs\myenv\Library\plugins\platforms

into the MATLAB folder

C:\Program Files\MATLAB\R2020b\bin\win64\platforms

While doing the copy, I overwrote three dlls which already existed in the MATLAB folder.

Eric
  • 1
  • 1