How to use a virtual environment's python instead of the one that ships with houdini?

   7103   11   6
User Avatar
Member
390 posts
Joined: Jan. 2012
Offline
I have a virtual environment and want Houdini to use that python instead of the one that ships with it.


My hope was that if I just sourced the virtualenv before sourcing houdini_setup_bash, it would pick it up.


The documentation says that I should point LD_PRELOAD to libpython2.7.so or include ‘/path/to/python/lib’ in LD_LIBRARY_PATH.

However, I can't find libpython2.7.so inside the virtual environment, and any ‘lib’ folder inside the venv that I add to LD_LIBRARY_PATH doesn't get picked up.

So my understanding now is that virtual environments don't come bundled with a full stand-alone installation of python (like Houdini does) and instead use the system's python libraries (even though they do come with a python binary executable).

How do I tell Houdini to use the python in the virtual environment?

thanks!
.
User Avatar
Member
82 posts
Joined: March 2017
Offline
Have you ever resolved this issue?
User Avatar
Member
621 posts
Joined: Aug. 2008
Offline
is there a particular reason why you want to use your own environment instead the one that comes with Houdini?
User Avatar
Member
82 posts
Joined: March 2017
Offline
scipy, tensorflow
User Avatar
Member
178 posts
Joined: Jan. 2013
Offline
We're using Anaconda virtual environments successfully. Try those instead of the standard Python venv:

https://anaconda.org/ [anaconda.org]
User Avatar
Member
390 posts
Joined: Jan. 2012
Offline
Daniel_aRch
Have you ever resolved this issue?
I just built the correct env that I wanted from my venv during the launch of houdini instead of using houdini's houdini_setup_bash.
.
User Avatar
Member
2 posts
Joined: Jan. 2020
Offline
Hi all,

I am trying to set up an anaconda environment in which I can use tensorflow, scipy, matplotlib, gzip, numpy and a couple other modules. This is within Houdini 18.0.348.

Has anyone gotten Houdini running with an anaconda environment instead of the python 2.7 that comes with Houdini?

Any advice getting started with this project would be much appreciated!
User Avatar
Member
42 posts
Joined: Feb. 2018
Online
On windows I was able to get a python 3 version of Houdini 18.5 to start up with a custom anaconda environment by following this basic idea:
https://www.youtube.com/watch?v=Fj17qnVOUvg&t=63s [www.youtube.com]
https://learncreategame.com/techart/houdini-environment-setup/ [learncreategame.com]

i.e adding a .json package to startup which contains a custom "path" environment variable which points to a folder containing a python3.7libs\pythonrc.py script, which appends my conda environment .../myCondaEnv/Lib/sitepackages to sys.path

This kinda works, I can get scipy to import into Houdini like this, but not keras or tensorflow as there appears to be a conflict with one of their dependencies - the version of h5py / HDF5 used by Houdini:

https://www.sidefx.com/forum/topic/60599/ [www.sidefx.com]

If anyone finds a fix for this in future please reply to this thread...
Edited by Eche - May 26, 2021 04:12:47
User Avatar
Member
275 posts
Joined: Sept. 2012
Offline
Hi there

Has someone fount out a TOP template to setup a launch a custom anaconda env using PDG TOP?
Like :
Step 1. Initialisation :: launch anaconda with a custom env loaded. ini the env once
Step 2. In the previously created shell, run generate and send commands to that shell using some PDG wedges variants.

Please let's me know... Here is some additional information below how we could possibly do that
Cheers,

Vincent*

""You set Python execution to the external environment with PythonBin.
To prevent accidents, temporarily change PYTHONHOME to the external environment upstream. However, since ImageMagick is processed in an external environment, it will be reset after processing. There are many cases where this works even without it, so it's just a charm...""

Attachments:
FbyN5n6akAAZyaa.png (26.8 KB)
FbyUJ2JaIAER-KV.png (84.1 KB)

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
User Avatar
Member
158 posts
Joined: July 2005
Offline
vinyvince
Hi there

Has someone fount out a TOP template to setup a launch a custom anaconda env using PDG TOP?
Like :
Step 1. Initialisation :: launch anaconda with a custom env loaded. ini the env once
Step 2. In the previously created shell, run generate and send commands to that shell using some PDG wedges variants.

Please let's me know... Here is some additional information below how we could possibly do that
Cheers,

Vincent*

""You set Python execution to the external environment with PythonBin.
To prevent accidents, temporarily change PYTHONHOME to the external environment upstream. However, since ImageMagick is processed in an external environment, it will be reset after processing. There are many cases where this works even without it, so it's just a charm...""

Have you figured it out? I need that as well but just started looking into it.
User Avatar
Member
275 posts
Joined: Sept. 2012
Offline
Hola

I couldn't find the time to give more attention , I was busy making some foam characters FX transformation to help a client
Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
User Avatar
Member
10 posts
Joined: Oct. 2014
Offline
After stumbling upon something similar i found another thread that helped me set my conda environment inside houdini.

The thread doesnt have a solution for the problem that user is asking for but if you check the attached images you can see how they setup the environmentedit node and the subsequent Python Script node correctly, you just need to make the file addresses according to your session:

https://www.sidefx.com/forum/topic/86588/ [www.sidefx.com]

In my case i used this to run the H20 ML terrain training example in H19 and it works.
  • Quick Links