Jump to content

How to set up pycharm for hou on win10


Ontheway

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'

 

Link to comment
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

Link to comment
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.

Link to comment
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.☺

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...