Jump to content
Ontheway

How to set up pycharm for hou on win10

Recommended Posts

I  have added  interpreter " C:\Program Files\Side Effects Software\Houdini 16.0.705\python27\python2.7.exe ".

Added paths "C:\Program Files\Side Effects Software\Houdini 16.0.705\houdini\python2.7libs " to pycharm.

 

added "C:\Program Files\Side Effects Software\Houdini 16.0.705\houdini\python2.7libs" to system's PATH variable of win10

 

but when i type in "from PySide2 import  QtWidgets "   

i get the error message in PyCharm : Unresolved reference 'PySide2'

 

Share this post


Link to post
Share on other sites

PySide2 libraries are located in ....Houdini 16.0.705\python27\lib\site-packages-ui-forced ... something like that, don't remember exact folder name.

Share this post


Link to post
Share on other sites
2 hours ago, Stalkerx777 said:

PySide2 libraries are located in ....Houdini 16.0.705\python27\lib\site-packages-ui-forced ... something like that, don't remember exact folder name.

thank u. it's already included in my external libraries.

how to import it without any error.

 enable auto-completing or suggesting

Share this post


Link to post
Share on other sites

There are some complexities with Qt bindings at present. There are Python2 and Python3 branches, and PySide, PySide2, PyQt4, PyQt5 bindings. Back then when only Python2 and Qt4 existed, everything was simple: you either go with PySide or PyQt4. Now it's more complicated UNLESS you compile the bindings yourself.

So If you want PySide2 for Python2 on windows you have to compile it yourself. Same for PyQt5. We are pretty stuck with Python2 for at least until 2020 (see http://www.vfxplatform.com/)

Another quick solution is to install Python3 and PyQt5 (pip3 install pyqt5), and then use houtil.Qt wrapper:

from hutil.Qt import QtWidgets, QtCore

But why do we need to install Python3 and PyQt5 then? Well, just to be able to use PyCharm features!

In PyCharm type this:

from hutil.Qt import QtWidgets, QtCore
if False:
	from PyQt5 import QtWidgets, QtCore

You trick PyCharm to use PyQt5 libraries for autocompletion. It's a very quick and not so reliable solution because PyQt5 and PySide2 are different, as well as Python2 and Python3

Note that you can use https://github.com/mottosso/Qt.py (hutil.Qt is basically the same) which abstracts the bindings problem and your code will use whatever library is available at that time. But you won't have PyCharm completion which is sad.

So the take away is: for serious development with PyCharm + Houdini, you want to compile PySide2 bindings.

P.S. quite a long post :) Maybe someone finds it useful. I'm a long time PyCharm user and still haven't found the working solution for Houdini and Qt development that works on all platforms.

Share this post


Link to post
Share on other sites
7 hours ago, Stalkerx777 said:

There are some complexities with Qt bindings at present. There are Python2 and Python3 branches, and PySide, PySide2, PyQt4, PyQt5 bindings. Back then when only Python2 and Qt4 existed, everything was simple: you either go with PySide or PyQt4. Now it's more complicated UNLESS you compile the bindings yourself.

So If you want PySide2 for Python2 on windows you have to compile it yourself. Same for PyQt5. We are pretty stuck with Python2 for at least until 2020 (see http://www.vfxplatform.com/)

Another quick solution is to install Python3 and PyQt5 (pip3 install pyqt5), and then use houtil.Qt wrapper:


from hutil.Qt import QtWidgets, QtCore

But why do we need to install Python3 and PyQt5 then? Well, just to be able to use PyCharm features!

In PyCharm type this:


from hutil.Qt import QtWidgets, QtCore
if False:
	from PyQt5 import QtWidgets, QtCore

You trick PyCharm to use PyQt5 libraries for autocompletion. It's a very quick and not so reliable solution because PyQt5 and PySide2 are different, as well as Python2 and Python3

Note that you can use https://github.com/mottosso/Qt.py (hutil.Qt is basically the same) which abstracts the bindings problem and your code will use whatever library is available at that time. But you won't have PyCharm completion which is sad.

So the take away is: for serious development with PyCharm + Houdini, you want to compile PySide2 bindings.

P.S. quite a long post :) Maybe someone finds it useful. I'm a long time PyCharm user and still haven't found the working solution for Houdini and Qt development that works on all platforms.

thank u. I'll try this.☺

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×