HOUDINI_PACKAGE_DIR Ignored when using HAPI

   921   6   3
User Avatar
Member
20 posts
Joined: March 2019
Offline
Hi guys,

I have a problem with our builders setup. On the builders I am generating a simple .env file which I am passing to HAPI_Initialize.
It contains some custom variables + HOUDINI_PACKAGE_DIR, as we are storing our packages outside of Documents\houdini18.0\packages.

I know that the env file is being read properly by HAPI as I can print my custom vars during cooking and they contain the right values. However the package does not seem to be loaded! We are missing hdas as the otl path was not updated with the one from our package

I can also say that the env file is correct as if I put its content to the C:\Users\heya\Documents\houdini18.0\houdini.env and launch HoudiniFX, the package gets loaded and everything is working, not when triggered from HAPI though

please help!
Tom
User Avatar
Member
20 posts
Joined: March 2019
Offline
Here is some more details:

I am setting up the variable as:

HOUDINI_PACKAGE_DIR = D:\mypath\packages;&;

I have also tried using hapi:
HAPI_SetServerEnvString(m_Session, “HOUDINI_PACKAGE_DIR”, “D:\mypath\packages;&;”);

When cooking I can print the HOUDINI_PACKAGE_DIR variable, its there. But ignored.

If I copy the package file to C:\Users\user\Documents\houdini18.0\packages, it all starts working, however does not meet my requirement of loading the packages from some other location.
Edited by tpastyrik2k - July 2, 2020 08:50:02
User Avatar
Staff
571 posts
Joined: May 2017
Offline
I've responded to your bug about this, but posting it here for others as well:

By design, HOUDINI_PACKAGE_DIR is only supported when set in the process environment before launching Houdini or HARS (i.e. HAPI server). It is not supported when specified via houdini.env. The reason is that the packages are processed before houdini.env, and are in fact, meant to replace houdini.env.

For now, the recommendation would be set HOUDINI_PACKAGE_DIR as an environment variable for your process. Then load packages dynamically, using the conditional expression mechanism specified here: https://www.sidefx.com/docs/houdini18.0/ref/plugins.html#package_path [www.sidefx.com]

Another option is to start the HARS server manually (instead of using HAPI_StartThriftNamedPipeServer or HAPI_StartThriftSocketServer) in a new process with the HOUDINI_PACKAGE_DIR environment variable set beforehand. Then connect to it with HAPI_CreateThriftNamedPipeSession or HAPI_CreateThriftSocketSession. So basically you have your own version of HAPI_StartThriftNamedPipeServer / HAPI_StartThriftSocketServer, where you can set up your own environment for it.
User Avatar
Member
20 posts
Joined: March 2019
Offline
Thanks Seelan!

Your advises has led to a successful load of the package along with all the variables needed!

Cheers!
Tom
User Avatar
Member
7 posts
Joined: April 2019
Offline
Hi Seelan,

For now, the recommendation would be set HOUDINI_PACKAGE_DIR as an environment variable for your process. Then load packages dynamically, using the conditional expression mechanism specified here: https://www.sidefx.com/docs/houdini18.0/ref/plugins.html#package_path [www.sidefx.com]

I am trying the suggested method (option 1) but I must be doing something wrong. (the option 2 you mentioned is out of my reach).

I have my custom packages folder in a centralized directory (different from the default scanned packages directory)

How do I
set HOUDINI_PACKAGE_DIR as an environment variable for your process
?
I imagine this does not refer to setting the houdini.env file, since you mentioned that this is loaded after the packages.



If I load the packages dynamically using:
{
    "package_path" : "path to my custom folder"
}


Would this json file need to be placed in one of the default packages directory?



Thanks for helping.
User Avatar
Staff
177 posts
Joined: Feb. 2018
Offline
HOUDINI_PACKAGE_DIR must be set in your environment, not in houdini.env or a package json file but prior to launch Houdini.

e.g. from a bash shell on Windows

. export HOUDINI_PACKAGE_VERBOSE=1
. export HOUDINI_PACKAGE_DIR=c:/temp/foo
. hconfig -xa
= = = Houdini Package log = = =
Loading: C:/Users/marcb/DEV/HOUDINI/dev/hfs/packages/kinefx.json

Loading: C:/Users/marcb/DEV/HOUDINI/dev/hfs/packages/viewer_handle_demo.json

Loading: c:/temp/foo/package.json

Processing: C:/Users/marcb/DEV/HOUDINI/dev/hfs/packages/kinefx.json

Processing: C:/Users/marcb/DEV/HOUDINI/dev/hfs/packages/viewer_handle_demo.json

Processing: c:/temp/foo/package.json

HFS := 'C:/Users/marcb/DEV/HOUDINI/dev/hfs'
HOME := 'C:/Users/marcb'
HOUDINI_DESKTOP_DIR := 'C:/Users/marcb/Desktop'
HOUDINI_OS := 'Windows'
HOUDINI_PACKAGE_DIR := 'c:/temp/foo'
HOUDINI_PACKAGE_VERBOSE := 1
HOUDINI_PATH := 'c:/temp/foo;C:/Users/marcb/DEV/HOUDINI/dev/hfs/packages/viewer_handle_demo;C:/Users/marcb/DEV/HOUDINI/dev/hfs/packages/kinefx;&'
HOUDINI_TEMP_DIR := 'C:/Users/marcb/AppData/Local/Temp/houdini_temp'
HOUDINI_USER_PREF_DIR := 'C:/Users/marcb/houdini18.6'
SHELL := 'C:/PROGRA~1/Git/usr/bin/bash.exe'
USER := 'marcb'

c:/temp/foo/package.json
{    
"path" : "c:/temp/foo"
}
User Avatar
Member
7 posts
Joined: April 2019
Offline
Hi mabelzile!
thanks for clarifying.

For those of you using Shotgun Desktop to launch Houdini, you will have to set the environment variables in the “Before App Launch Hook” python script ( in the project configuration )

For example:
...
os.environ["HSITE"] = "pathtomyfolderonserver/houdini18.0"
os.environ["HOUDINI_PACKAGE_DIR"] = "{}/packages".format(os.environ["HSITE"])
...
  • Quick Links