Jump to content
Wooshum

Using External Python Modules with Compiled C++ Dependencies (Windows)

Recommended Posts

Hi All,

When using external python modules from a python operator I usually use:

import sys
pyModPath = node.parm('pyModPath').eval()
sys.path.append(pyModPath)

This works perfectly for pure python modules but I am having issues with modules that require compiled external dependencies, in particular i am needing to use the pyproj module: https://pypi.python.org/pypi/pyproj? 

I have tried using a precompiled python wheel when installing through PIP but it still throws an error that the DLL could not be found in HOU (have double checked that I am using and installing for 64bit). I am typically installing the pip modules in the root Python27 folder and linking to the 'Lib\site-packages' folder in that directory (for pyre python I can link to modules anywhere). Unfortunately I am stuck using Windows at the moment.

As a note: when using the pyproj module outside of Houdini (through the command line) it works fine.

Does anyone have any tips / suggestions how to get these compiled modules functioning within HOU?

Share this post


Link to post
Share on other sites

Doesn't matter compiled or not, just make sure it's in your PYTHONPATH or sys.path.append it. Most important here is compatibility of compiled module with Houdini's python interpreter. Your system Python version should be the same as Houdini's.

Share this post


Link to post
Share on other sites

Thanks for that Alex. Looks like Houdini 15.5 is bundled with Python 2.7.5 (October 2015) - will install as the system version and give it a go. 

Share this post


Link to post
Share on other sites

Sorry for digging up an old post, but did you ever find a resolution to your issue here? I am seeing a similar problem with Houdini 16.5 being unable to load a compiled python package on Windows. I have verified that the package works with the system python installation, however when importing into Houdini it does not work.

Using WinDBG I have tracked this issue to a problem loading the MSVCR90.dll runtime library - this resolves correctly on the system python install but not within Houdini.

Any thoughts?

Share this post


Link to post
Share on other sites

Just following up here with the solution to this issue.

The problem is that the current version of Houdini (16.5) is built on Windows using Visual Studio 2015. The Houdini python build is also built using VS 2015. The problem arose as the default python 2.7.5 on Windows is built using VS 2008, so any precompiled binary modules, or modules built locally with the system Python 2.7.5, will be built using VS 2008. This then leads to incompatibilities which manifest in a generic DLL not found error.

The solution is to build the module locally using Houdini's python install. You will need to have VS 2015 installed, and then it simply a matter of executing setup.py on the module to be built while running in Houdini's python environment. After that everything should work correctly. If it is doing the right thing, you will see references to "Microsoft Visual Studio 14.0" in the build messages that indicate the correct compiler version is being used.

Hopefully this is helpful to others as it was very non-obvious to me at the time.

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

×