Search - User list
Full Version: Autocompletion Pycharm Houdini
Root » Technical Discussion » Autocompletion Pycharm Houdini
Matthew05
Hi,
After a reinstall of Windows, I need to setup Pycharm with Houdini again. So I managed to get the hou module loaded inside of Pycharm, but I don't have any autocompletion working. Here is what I have. If I use the Python Console inside of Pycharm, I don't have any issue.
Any idea of where it can comes from?
I'm using Win10, Pycharm Community 2020.1
doctorbob
Hi Ioness,

if i'm understanding your setup correctly, you either need to

1) use hython as your python interpreter (https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#) - point it to /your/houdini/installation/hython

this will give you autocomplete, but will pull a license (this may or may not bother you)

OR

2) use a hou stub file like the attached. make sure it's somewhere on your PYTHONPATH so pycharm an find it, and you'll get (basic) autocomplete for hou. this will run in a non-houdini python interpreter, won't pull a license and is more friendly if you're making cross-application code


cheers,
chrisg
Matthew05
Hi Doctorbob,
So I tried to do as you told me, to use hython as my python interpreter but I am still having the same issue. I will have to test it on Linux to see if it's doing the same thing. On the meantime, I will use VSCode, which is giving me a full working autocompletion.

I also tried using both houdini version with python 2.7 and python 3.7, both giving me the same result
Matthew05
Hey everyone,
So I manage to find a solution. The way to get it working was to simply import the module like that inside of Pycharm:
import hou as hou
I now have full autocompletion working correctly. Due to my knowledge of python, I am not sure of why I need to do it that way instead of just doing
import hou
This same import is working perfectly with Visual Studio Community, so I guess this might be coming from PyCharm
So if anybody as an idea of why Pycharm is behaving this way, I will be glad too here it
neonjunkyards
does anyone have any updates on this? Autocomplete was working fine in pycharm a few weeks ago but after upgrading Houdini daily builds, updating pycharm, now hou autocomplete is completely broken.


Tried hython interpreter, houdini python2.7, system python2.7, added $HFS/houdini/python2.7libs to extra paths in pycharm, added $HFS/bin to $PATH in system environment variables, rolled back houdini installs, rolled back pycharm installs, on 2 different machines. Nothing works


The stubs file works ok for first level autocomplete (hou.) but stops working on any level deeper. VSCode works perfectly with exactly the same configuration as pycharm, but VScode PySide2 autocomplete isn't great…


This makes me think this is a pycharm problem not a Houdini problem, but has anyone solved this?
elovikov
Hi!

There's a limit in pycharm on a file length for indexing. By default it's 2.56 and recently hou.py just exceeds that limit

So to fix that go to Help -> Edit Custom Properties (it asks to create one if it doesn't exist, just hit Create)



Then put this line to idea.properties:
idea.max.intellisense.filesize=3000



3000 is just an example you can make it higher to prevent problems in future

Then go to File -> Invalidates Cache / Restart. That should fix the issue with indexing (so path to hou.py has to be configured correctly and you need only $HFS/houdini/python2.7libs btw)
neonjunkyards
That worked! Thank you so much, that was driving me mad
Shadowjonny
I keep getting any error when I try to add hython.exe in my Pycharm Python Interpreter i get this error :
Error: Standard Python ‘venv’ module not found
Anyone know why? I cant get Pycharm to work with houdini using 18.5.351, python 2.7.17, Pycharm 2020.2.3

Nvm got it working now
wyhinton1
Tried adding hython.exe and hython3.7.exe as interpreters in VSCode and I get "An invalid Python interpreter is selected, please try changing it to enable features such as IntelliSense, linting and debugging."
wyhinton1
I just ended up copying the entire python3.7libs folder from "C:\Program Files\Side Effects Software\Houdini 19.0.622\houdini\python3.7libs" into my VSCode project and it worked.

wyhinton1
Tried adding hython.exe and hython3.7.exe as interpreters in VSCode and I get "An invalid Python interpreter is selected, please try changing it to enable features such as IntelliSense, linting and debugging."
supersaqib
elovikov
Hi!

There's a limit in pycharm on a file length for indexing. By default it's 2.56 and recently hou.py just exceeds that limit

So to fix that go to Help -> Edit Custom Properties (it asks to create one if it doesn't exist, just hit Create)

Image Not Found


Then put this line to idea.properties:
idea.max.intellisense.filesize=3000

Image Not Found


3000 is just an example you can make it higher to prevent problems in future

Then go to File -> Invalidates Cache / Restart. That should fix the issue with indexing (so path to hou.py has to be configured correctly and you need only $HFS/houdini/python2.7libs btw)


This is the one that worked for me in combination with setting Hython to the interpreter. Not sure why it says Hython 3.11 when i only have Python 3.9 and chose Hython39.exe but i digress. Got it working with the python3.9libs too. Also looks like 3000 was not enough so i put it to 30000 cos i'm chaotic in nature.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB