Integrating Pycharm with houdini tutorial?
9304 15 8- kriegmesser74
- Member
- 41 posts
- Joined: May 2021
- Offline
Well my hda script is getting larger and larger, and my eyesight is weaker and weaker, plus getting "in" and "out" for testing in the scene becomes really tiresome, stretching the window on hda script tab is really out of fashion (tear-able window would be so nice) so how do you integrate Pycharm? I have the latest (free) version 2021.2, Houdini 17.5.391, and Houdini python support archive (hyton interpreter I guess), what's next? Do I need something more? I did my share of digging on internet but all topics on different forums are at least five years old and with dozens of "solutions" who scare the pants off me... I tried to integrate Sublime Text 3 but after poking the houdini environment file Houdini froze on startup... no thank you...
- Andr
- Member
- 900 posts
- Joined: Feb. 2016
- Offline
Hello Krieg,
Few months ago I submitted a feature request to improve the UI of the Type Properties Window. Feel free to add your name to ID#112807
Requests:
A) the Create Parameters area in the Parameters section should be collapsible.
B) A floating TAB Menu to add new parameters could serve very well, like the TAB Menu for operators in the network view.
C) In the Scripts sections, the scripts area on the left should be collapsible as well.
Point C) should help to have a larger area for coding in the hda script tab.
cheers
Few months ago I submitted a feature request to improve the UI of the Type Properties Window. Feel free to add your name to ID#112807
Requests:
A) the Create Parameters area in the Parameters section should be collapsible.
B) A floating TAB Menu to add new parameters could serve very well, like the TAB Menu for operators in the network view.
C) In the Scripts sections, the scripts area on the left should be collapsible as well.
Point C) should help to have a larger area for coding in the hda script tab.
cheers
Edited by Andr - Aug. 12, 2021 14:11:43
- kriegmesser74
- Member
- 41 posts
- Joined: May 2021
- Offline
After a LOT of mumbo-jumbo with visual code studio I managed it to integrate with Houdini... Jesus Christ man... first download houdini plug-in((!!!) WHY THE F***K do we need a plug-in for this??!!?!) then assign VCS as external text editor, then choose houdini's version of python as interpreter, then write some MORE code in VCS to set path variables (which I didn't remember because I don't care) so you could have full integration i.e. import hou module and auto suggestion... and then FINALLY after more setting of color themes and size of fonts I can have full screen, medium font size solution with a good dark (i.e. black) background so I don't cry my eyes out...
Sorry for the language... but couldn't SideFX integrate some of these solutions with Houdini by default? At least ones who are free after all? Did I mention that I have tried to integrate SublimeText, Pycharm and one more who I didn't remember... they did not work either... and lack of instructions or tutorials is abysmal... few years old... different versions etc. etc.
Sorry for the language... but couldn't SideFX integrate some of these solutions with Houdini by default? At least ones who are free after all? Did I mention that I have tried to integrate SublimeText, Pycharm and one more who I didn't remember... they did not work either... and lack of instructions or tutorials is abysmal... few years old... different versions etc. etc.
Edited by kriegmesser74 - Aug. 13, 2021 13:31:21
- JustinCrapse
- Member
- 5 posts
- Joined: Oct. 2016
- Offline
I agree Krieg. We can't write good, robust python code without at least one good IDE supported and documented for setup. I'm working in Pycharm and I never got it to autocomplete. can't seem to get any sort of hou module from the hython or python installs in houdini. No idea where to look at this point.
- Ids
- Member
- 7 posts
- Joined: Feb. 2017
- Offline
Here is how I got the PyCharm integration working, including autocomplete:
From there on, you can use the hou module the same way you would inside Houdini, for example:or
I hope this helps! I couldn't attach pictures because that would be quite a few pictures, so I hope that my instructions are clear enough to follow. If you need any further help, feel free to reach out to me.
- Go to your Python Interpreter settings (in the bottom right, or File>Settings>Project>Python Interpreter).
- Click the gear icon in the upper right corner to show all your interpreters.
- In the top left corner of the new window, click the "+" button to add a new interpreter.
- Pick the System Interpreter and then browse to the path of your Houdini installation that has the Python executable that you want to use (2.7 vs 3.7 for example). The path probably looks something like this: C:\Program Files\Side Effects Software\Houdini 18.x.xxx\python27\python2.7.exe.
- After you've pressed OK in the window, you will go back to the window with the list of interpreters. Select your new interpreter and click the 5th button from the top left to "Show paths for the selected interpreter".
- By default it should have some paths to libraries already. However, the specific hython libs are probably not in the list, so you need to add that by pressing the "+" in the top left corner. The path should look something like this: C:\Program Files\Side Effects Software\Houdini 18.x.xxx\houdini\python2.7libs (or 3.7libs if you want to use 3.7). These libs will give you the autocomplete functionality for the HOM classes.
- Last but not least, for each Houdini Python project you need to set the interpreter to this new interpreter. And in order to get the autocomplete working properly, you need to import the hou module at the start of each file where you want to use it. It is as simple as import hou, and PyCharm should recognize the module from the interpreter.
From there on, you can use the hou module the same way you would inside Houdini, for example:
import hou hou.node("../..")
hou.pwd().geometry()
I hope this helps! I couldn't attach pictures because that would be quite a few pictures, so I hope that my instructions are clear enough to follow. If you need any further help, feel free to reach out to me.
Technical Animator (using KineFX) at Enliven | Social Enterprise
idsboonstra.artstation.com
idsboonstra.artstation.com
- AhmedHindy
- Member
- 128 posts
- Joined: Oct. 2020
- Offline
- raincole
- Member
- 422 posts
- Joined: Aug. 2019
- Offline
"python.autoComplete.extraPaths": [
"C:\\Program Files\\Side Effects Software\\Houdini 19.0.455\\houdini\\python3.7libs",
],
"python.analysis.extraPaths": [
"C:\\Program Files\\Side Effects Software\\Houdini 19.0.455\\houdini\\python3.7libs",
],
This is how to setup autocompletion for VScode. If you put your Python code in a package, just add them as well.
Note that VSCode doesn't do type inference, and SideFx hasn't written any type annotation in their Python. So the autocompletion is rather limited.
- Poetsofthefall
- Member
- 5 posts
- Joined: Dec. 2017
- Offline
- AhmedHindy
- Member
- 128 posts
- Joined: Oct. 2020
- Offline
Ids
Here is how I got the PyCharm integration working, including autocomplete:
- Go to your Python Interpreter settings (in the bottom right, or File>Settings>Project>Python Interpreter).
- Click the gear icon in the upper right corner to show all your interpreters.
- In the top left corner of the new window, click the "+" button to add a new interpreter.
- Pick the System Interpreter and then browse to the path of your Houdini installation that has the Python executable that you want to use (2.7 vs 3.7 for example). The path probably looks something like this: C:\Program Files\Side Effects Software\Houdini 18.x.xxx\python27\python2.7.exe.
- After you've pressed OK in the window, you will go back to the window with the list of interpreters. Select your new interpreter and click the 5th button from the top left to "Show paths for the selected interpreter".
- By default it should have some paths to libraries already. However, the specific hython libs are probably not in the list, so you need to add that by pressing the "+" in the top left corner. The path should look something like this: C:\Program Files\Side Effects Software\Houdini 18.x.xxx\houdini\python2.7libs (or 3.7libs if you want to use 3.7). These libs will give you the autocomplete functionality for the HOM classes.
- Last but not least, for each Houdini Python project you need to set the interpreter to this new interpreter. And in order to get the autocomplete working properly, you need to import the hou module at the start of each file where you want to use it. It is as simple as import hou, and PyCharm should recognize the module from the interpreter.
From there on, you can use the hou module the same way you would inside Houdini, for example:orimport hou hou.node("../..")hou.pwd().geometry()
I hope this helps! I couldn't attach pictures because that would be quite a few pictures, so I hope that my instructions are clear enough to follow. If you need any further help, feel free to reach out to me.
I keep getting this error
- Matthew05
- Member
- 94 posts
- Joined: April 2011
- Offline
Hi AhmedHindy
I had the same issue. If you are using python3.7 or more recent in Windows, it's more likely because of the way python loads dll. Before 3.7, adding the $HFS/bin folder to the path was good., but the path variable is not used anymore. Instead, you must use this:
Here is the explaination:
python load dll failed [bugs.python.org]
I had the same issue. If you are using python3.7 or more recent in Windows, it's more likely because of the way python loads dll. Before 3.7, adding the $HFS/bin folder to the path was good., but the path variable is not used anymore. Instead, you must use this:
import os os.add_dll_directory("houdini_install/bin") import hou
Here is the explaination:
python load dll failed [bugs.python.org]
- SWest
- Member
- 308 posts
- Joined: Oct. 2016
- Offline
- magicom
- Member
- 3 posts
- Joined: April 2021
- Offline
choose a python interpreter then open vs code settings.json add:
"python.autoComplete.extraPaths": [
"C:\\Program Files\\Side Effects Software\\Houdini 19.5.435\\houdini\\python3.9libs"
],
"python.analysis.extraPaths": [
"C:\\Program Files\\Side Effects Software\\Houdini 19.5.435\\houdini\\python3.9libs"
],
it should recognize hou now. if your code still don't autocomplete it perhaps because the type is any, you should provide type hint when add a var:
import hou
obj: hou.Node = hou.node('/obj')
geo: hou.Node = obj.createNode('geo', 'my_geo')
now geo. will pop up suggestion
For Pycharm:
"python.autoComplete.extraPaths": [
"C:\\Program Files\\Side Effects Software\\Houdini 19.5.435\\houdini\\python3.9libs"
],
"python.analysis.extraPaths": [
"C:\\Program Files\\Side Effects Software\\Houdini 19.5.435\\houdini\\python3.9libs"
],
it should recognize hou now. if your code still don't autocomplete it perhaps because the type is any, you should provide type hint when add a var:
import hou
obj: hou.Node = hou.node('/obj')
geo: hou.Node = obj.createNode('geo', 'my_geo')
now geo. will pop up suggestion
For Pycharm:
Edited by magicom - Dec. 20, 2022 10:27:31
- indigosm
- Member
- 46 posts
- Joined: April 2020
- Offline
- guilhermecasagrandi
- Member
- 258 posts
- Joined: March 2011
- Offline
indigosm
so in the newer pycharm, they moved stuff around in the python interpreter / project structure windows. has anyone found how you're supposed to add the hou library now?
i thought adding the python3.7libs dir to the 'project structure' and then marking the dir as 'sources' would get it to work, but nope. if i type in hou., i get no real autocompletes.
I'm using vscode and I'm quite happy (for several years now). The hou module works (somewhat) ok, since it doesn't always knows the type of instance you are referring to. Plus, we have a VEX extension for function autocompletion.
On vcs code, you should add (preferences->python->python settings) "$HFS\\houdini\\python3.9libs" on "python.analysis.extraPaths" list.
If you really need to use PyCharm, It'd probably have a similar way to add the path to the python environment.
- indigosm
- Member
- 46 posts
- Joined: April 2020
- Offline
guilhermecasagrandi
python settings) "$HFS\\houdini\\python3.9libs" on "python.analysis.extraPaths" list.
If you really need to use PyCharm, It'd probably have a similar way to add the path to the python environment.
thanks i finally got it working. and yeah i absolutely love pycharm for everything except for one or two things like this. hah.
- Jonathan de Blok
- Member
- 249 posts
- Joined: July 2013
- Offline
-
- Quick Links