install python packages

   Views 13050   Replies 15   Subscribers 4
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
I am trying to install a python package called pyephem (http://rhodesmill.org/pyephem/) [rhodesmill.org] which will let my find the position of the moon / sun for a particular time / location.

I am using windows, and the package has a windows installer. This all works fine, except that it will not let me install it to the Houdini embedded python, instead it looks at the windows registry, and installs it to CPython25. I want to use it in houdini…

How do I install packages to Houdini embedded python? Or can I make Houdini use standard python on windows? Or do I have to compile the source code with the Houdini compiler?
Patrick
User Avatar
Member
874 posts
Joined: 10月 2008
Offline
From the top of my head…

…try putting it into:

…\Houdini 10.0.xxx\houdini\scripts\python
--
Jobless
User Avatar
Member
201 posts
Joined: 7月 2005
Offline
phtj
I am trying to install a python package called pyephem (http://rhodesmill.org/pyephem/) [rhodesmill.org] which will let my find the position of the moon / sun for a particular time / location.

I am using windows, and the package has a windows installer. This all works fine, except that it will not let me install it to the Houdini embedded python, instead it looks at the windows registry, and installs it to CPython25. I want to use it in houdini…

How do I install packages to Houdini embedded python? Or can I make Houdini use standard python on windows? Or do I have to compile the source code with the Houdini compiler?

You should be able to use this in Houdini if it's installed in the default location. You should be able to simply use the import statement, no?
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
rdms
You should be able to use this in Houdini if it's installed in the default location. You should be able to simply use the import statement, no?

Unfortunately not on Windows, where Houdini uses its own Python build. You could also put your modules to $HOME/houdinix.x/scripts/python
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
Thanks for the suggestions… it works

I installed in the default C:\Python25 version of Python. Then I copied the ephem folder from C:\Python25\Lib\site-packages over to …\Houdini 10.0.xxx\houdini\scripts\python and it worked…

But I still have a question…

The reason I though this would not work is that there is a bunch of complied c code in there as well. I did a bit more digging around… I found this thread from 2007
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=9847&highlight=python+package+install [sidefx.com]

One of the developers (Rob / rvinluan) writes:
You can put your python modules in $HOME/houdiniX.X/scripts/python …
One caveat to all of this is that when installing python modules on Windows, any compiled extensions (i.e. *.dll or *.pyd files) must be built with the same compiler used to build Houdini (as mentioned above). For win32, we use MSVC2003 and for win64, we use MSVC2005.

Does this mean that I was just lucky - and that my package was built using the right compiler?
Patrick
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
Offline
That is a common scenario for compiling python for the past couple years but yes, as always, a bit lucky.
There's at least one school like the old school!
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
Being lucky is good, but it never lasts

The next package I need to install is pywin32 by Mark Hammond. Again, it has plenty of compiled ‘stuff’ in their - including a whole bunch of pyd files. I tried the same as last time - 1) I installed pywin32 in the default location, 2) I copied the newly created folders and files across to Houdini, 3) I tried some imports.

Unfortunately, I get import errors when it is trying to import the DLLs (pyd files). I am guessing that this time, the pywin32 package has been complied using the wrong compiler…

So should I try re-compiling the source - which compiler should I use?
Patrick
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
Should msvc 7.1 work?
Patrick
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
I have solved it - i fact pywin32 is compiled with MSVC 7.1, which is the right one (I am lucky again).

The reason that it was not working was that 1) the python path needed to be updated, and 2) some dlls (pythoncom25.dll and pywintypes25.dll) had to be copied over to the windows system32 folder.

Now it works fine.

Regarding the first problem - I updated the Python path for houdini interactively, using Python. Is there somewhere I can do this permanently in a config file?
Patrick
User Avatar
Member
9 posts
Joined: 3月 2010
Offline
Soothsayer
From the top of my head…

…try putting it into:

…\Houdini 10.0.xxx\houdini\scripts\python

Hello do u know a similar method for houdini running on mac osX?
User Avatar
Member
539 posts
Joined: 12月 2005
Offline
I'm actually trying to get the exact same python library to work as in the original post and running into roadblocks that are beyond my ease and know-how

https://rhodesmill.org/pyephem/ [rhodesmill.org]

Can anyone give a step by step on the most straightforward way to get this to work with a normal 18.5 Houdini Build? I've tried the method in this post without luck. Perhaps it's because I'm using 18.5?


phtj
Thanks for the suggestions... it works

I installed in the default C:\Python25 version of Python. Then I copied the ephem folder from C:\Python25\Lib\site-packages over to ...\Houdini 10.0.xxx\houdini\scripts\python and it worked...

But I still have a question...

The reason I though this would not work is that there is a bunch of complied c code in there as well. I did a bit more digging around... I found this thread from 2007
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=9847&highlight=python+package+install [www.sidefx.com]

One of the developers (Rob / rvinluan) writes:
You can put your python modules in $HOME/houdiniX.X/scripts/python ...
One caveat to all of this is that when installing python modules on Windows, any compiled extensions (i.e. *.dll or *.pyd files) must be built with the same compiler used to build Houdini (as mentioned above). For win32, we use MSVC2003 and for win64, we use MSVC2005.

Does this mean that I was just lucky - and that my package was built using the right compiler?
User Avatar
Member
539 posts
Joined: 12月 2005
Offline
Nevermind, got it! Used a Python 3 build with this process ..
https://wordpress.discretization.de/houdini/home/advanced-2/installing-and-using-scipy-in-houdini/ [wordpress.discretization.de]
User Avatar
Member
52 posts
Joined: 7月 2013
Offline
I used the same post as Andrew to install pip and scipy using Houdini Python 3. Then installed netCDF4 and other packages. I have not had any trouble installing packages and using them with 18.5.563 and Python 3.

Brad Carvey
Brad Carvey
User Avatar
Member
539 posts
Joined: 12月 2005
Offline
Thanks to this post I was successful. I made this for anyone who would like it. You'll need a few python packages which are imported on the python sop. Here's a demo

https://vimeo.com/549462315 [vimeo.com]

Attachments:
planetary_positions.v01.hda (23.1 KB)

User Avatar
Member
28 posts
Joined: 6月 2019
Offline
Hi all, once the modules are installed via hython pip, where are they located on disk? (Windows)

Thanks in advance!
User Avatar
Member
8 posts
Joined: 6月 2020
Offline
In my case I didn't want to mess up with default python installation on Houdini folder, in case I want to upgrade it. Instead I used Python venv (virtual environment), installed all required packages there and then added these packages to PYTHONPATH variable through packages json file like this
{"PYTHONPATH": [ "$JOB/CONFIG/Houdini/scripts/python/venv/Lib/site-packages" ], "method": "append"},
  • Quick Links