Jump to content

Is it possible to import hou module outside houdini?


catchyid

Recommended Posts

Hi,

If I try to import "hou" module using the standard python2.7 interpreter, it crashes. 

If I use the python interpreter that's shipped with Houdini and I import "hou" module, it also complains about jemalloc libs

I see that the only way to use "hou" module is either (1) inside houdini directly (e.g. in parameters), OR (2) by running hython --> Is this correct?

I just don't see it logical that I have a python module "hou" that can only be used inside hython interpreter? for example, If I were to write a studio wide tool that needs to process houdini object, then in this specific case I must hython, otherwise I can use python? 

Thanks

 

Link to comment
Share on other sites

Hi,

Just an update if someone is still reading :) It seems to me that application specific interpreters, such as hython in Houdini or mayapy for Maya, are just there to run their own python modules...I "think" over simplifying hou as just a standard python module is just wrong, i.e. it must be run by hython interpreter ... Now that seems rather limiting! what if you want to have a python script that processes both houdini and maya objects? It would be still possible, but this won't be in "one" application.

Link to comment
Share on other sites

It is possible(or at least was possible) to use the hou module in a standard system interpreter, there's even a help page somewhere in the docs. Using both Maya and Houdini interpreters within a single app (or package) could be tricky, but definitely possible and depends on your use case. Unless you required to use both APIs at the same time you can organize your code in such a way where Maya mypy instance communicates with a standalone Hython instance through a simple intermediate disk file or an RPC server.

  • Like 1
Link to comment
Share on other sites

Guys, I am not a developper by any means, but from what I understand, and "API" is an Application Programming Interface, which means it requires an instance of your application to be run in any case (Houdini, Maya...). The module you use "HOU" is just a library of functions that Python (or C++ in case of SDK) understands and calls the application (Houdini, Maya...). So it is really just an "interface" between standard programming language and an application.

I guess you can run an instance of your application in "command line" (Houdini or Maya with no GUI) and use that / declare it from a standard Python file executed in Python, and from there it should work.

But to don't ask my how, never tried with Houdini or Maya.

Link to comment
Share on other sites

Yes, what you says is correct JO. The problem I am facing is compatibility between binaries, meaning, we have  main components:

(1) the default python interpreter,

(2) python interpreter/libs that ships with Houdini (are they exactly the same like the default implementation, i.e. item 1, or do they have something special, I guess only SideFX people will know) 

(3) Hou python module

Now, a simple question: can I import (3) using (1) OR I "must" use (2) in order to import (3)? In theory, I should be able to use the default interpreter, ie (1), to import Hou but from my testing this is not the case. There are many reasons why for this limitation (for example, binaries complied with different flags, mismatched versions, it's too complicated...). Anyhow, my conclusion is that I must use (2) to import Hou. 

Now, add this compatibility issue using Maya modules, Maya Python interpreter...

 

Link to comment
Share on other sites

just an update : It's possible to import hou in standard python interpreter...the problem I was having is the python interpreter I used was compiled with gcc 5.4 and Houdini was compiled with gcc 6.3 --> so it's a binary (or ABI) incompatibility, hence the crash. To fix there are two solutions: either use the python interpreter shipped with Houdini, or update the python interpreter to match at least the same gcc version used to compile Houdini...

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...