Using PyQt5 for python panels

   3715   4   2
User Avatar
Member
94 posts
Joined: April 2011
Offline
Hey everyone,
I'm trying to wrap my head on how to get PyQt5 working so I can use it to make a python panel. So I installed it, tested it with my os python version (2.7) and everything is working. I copied the PyQt5 folder to the site package inside Houdini installation folder, like they say in the help.
Whatever I try when I import PyQt5.QtCore, I have this error and I really don't know where it is coming from: DLL load failed: cannot find specified procedure (but import PyQt5 is working fine). So I thought that there was something else to do to make it working. To check, I try to launch the python inside of the houdini folder and to make the same command and this time it worked correctly and I could display my ui.

I know I could use hutil.Qt, but it's telling me “QSQLITE driver not loaded” and I don't know how to fix it (whereas outside of Houdini, it is working fine)
Edited by Matthew05 - May 19, 2018 12:10:17
User Avatar
Staff
1255 posts
Joined: July 2005
Offline
Hello,

The “DLL load failed: cannot find specified procedure” error is likely due to a compiler version mismatch. Unfortunately on Windows, it is only possible to import compiled Python modules that are compiled with the same Visual Studio compiler version that Houdini is compiled with.

So for Houdini 16.5, the PyQt5 modules must be compiled with Visual Studio 2015 in order for them to work in Houdini.

If you can find pre-built MSVC2015 PyQt5 modules then that would be best. Otherwise you would need to compile PyQt5 from source using MSVC2015 which can be a pain.

The other option is to just use PySide2 which ships with Houdini. The PySide2 API is practically the same as PyQt5.

Cheers,
Rob
User Avatar
Member
94 posts
Joined: April 2011
Offline
Hey Rob,
Thanks for your help. I tried compiling them myself, and it also didn't work. (I couldn't get any driver loaded using QSqlDatabase to load a database containing a list of path of objects I made). Most likely it was a mistake of my part when I was doing it.
So I will end up using PySide2 as you suggested. I will try tomorrow to see if I am able to use the Sqldriver
User Avatar
Member
94 posts
Joined: April 2011
Offline
Hey everyone,
So following Rob's advice, I made my GUI using PySide2 and managed to get everything working. I'm now facing another issue, which is when I try to load my database inside of the interface. I still get the error message “no drivers found” when I'm trying this:
db = QSql.addDatabase(“QSQLITE”).

In the console, I have this error message being displayed:
QSQLITE driver not found
Drivers available:

So I tried to make the same code outside of Houdini and it is working fine.
Is there something to do to load these drivers inside of Houdini, like a line in the houdini.env ?

I'm on Windows10 Professional
Using python 2.7 outside of Houdini and PyQt5 to make the tests inside of PyCharm
User Avatar
Member
94 posts
Joined: April 2011
Offline
Hello everyone,
Got nearly everything working fine, made all the interface and the connection with the database working fine, but inside of maya.
The only thing missing is the way to add the drivers inside of Houdini.
I tried to add to the qt.conf file the path to the sqldrivers but it is not working (I put the sqldrivers inside the Qt_plugins in the houdini bin).
Does somebody has another idea? else I will give up on this, already spent too much time on that.


EDIT:
Finally managed to make it working !!!!! I first tried to copy the sqldrivers from PyQt5 from my Python sites packages but it didn't work, so I jst tried with taking the sqldrivers folder coming from Maya, and this time it was working fine and I could load my database

Thanks for the help
Edited by Matthew05 - July 21, 2018 17:26:17
  • Quick Links