Python comand line scripting import hou generates double free/corruption error

   3271   4   1
User Avatar
5 posts
Joined: Dec. 2017
Hello Houdini Gurus,

following the guide on command line scripting [] has worked very well for me in the past. However, with the recent Houdini 17 update, changing the HFS variable from 16.5 to 17.0 as indicated below, results in the following error:

WARNING: JE Malloc not configured.
Excessive memory fragmentation and poor performance may result.
If this is intentional, set
to remove this warning.
double free or corruption (out)

I am running Debian Buster and I have libjemalloc installed. Any suggestions what might cause the error or how I can load Houdini-17 files in an external python script?

Thanks in advance,


def enableHouModule():
    '''Set up the environment so that "import hou" works.'''
    import sys, os

    #import platform
    # Importing hou will load in Houdini's libraries and initialize Houdini.
    # In turn, Houdini will load any HDK extensions written in C++.  These
    # extensions need to link against Houdini's libraries, so we need to
    # make sure that the symbols from Houdini's libraries are visible to
    # other libraries that Houdini loads.  So, we adjust Python's dlopen
    # flags before importing hou.
    if hasattr(sys, "setdlopenflags"):
        old_dlopen_flags = sys.getdlopenflags()
        import DLFCN
        sys.setdlopenflags(old_dlopen_flags | DLFCN.RTLD_GLOBAL)

        import hou
    except ImportError:
        # Add $HFS/houdini/python2.7libs to sys.path so Python can find the
        # hou module.
        # works for 16.5, fails for 17.0 or 17.0.352 
        sys.path.append(HFS + "/houdini/python%d.%dlibs" % sys.version_info[:2])
        import hou
        if hasattr(sys, "setdlopenflags"):

User Avatar
8 posts
Joined: Dec. 2014
I'm also seeing this error when importing hou into an external python script (Linux Mint).
Nick Taylor []
User Avatar
183 posts
Joined: Nov. 2008
Starting from version 17 Houdini doesn't use systems Python anymore. I'd imagine that trying to use Houdini's libraries from the external interpreter could lead to all sorts of issues. Unless you absolutely must using system's Python for some reason, stick to Hython instead.
Aleksei Rusev
Sr. Graphics Tools Engineer @ Nvidia
User Avatar
9 posts
Joined: Sept. 2019
I'm seeing this as well on Houdini 19 / Ubuntu 20.04.

In my case I have to user an external interpreter (Py 3.7.12 from deadsnake)since gRPC won't import into Hython with ctype errors.
User Avatar
9 posts
Joined: Sept. 2019
OK actually just solved this. Follow this guide to setup jemalloc: []

Then if you run external python as suggested importing Hou module won't error about jemalloc. As of writing this latest jemalloc is 5.2.1 so worth getting latest and changing bash commands appropriately:

# installing jemalloc
tar xvjf jemalloc-5.1.0.tar.bz2
cd jemalloc-5.1.0
sudo make install

# running your app
LD_PRELOAD=/usr/local/lib/ python

FYI this is the doc showing how to load hou in external py interpreter: []

However DLFCN was deprecated in py 3.6, so just change:
import DLFCN
sys.setdlopenflags(old_dlopen_flags | DLFCN.RTLD_GLOBAL)

import ctypes
sys.setdlopenflags(old_dlopen_flags | ctypes.RTLD_GLOBAL)
  • Quick Links