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?
install python packages
13043 15 4- phtj
- Member
- 224 posts
- Joined: 6月 2009
- Offline
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
- rdms
- 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
Rob
Digital Supervisor | Stargate Studios Toronto
- symek
- Member
- 1390 posts
- Joined: 7月 2005
- Offline
- phtj
- 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:
Does this mean that I was just lucky - and that my package was built using the right compiler?
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
- old_school
- スタッフ
- 2540 posts
- Joined: 7月 2005
- Offline
- phtj
- 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?
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
- phtj
- Member
- 224 posts
- Joined: 6月 2009
- Offline
- phtj
- 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?
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
- yul000
- Member
- 9 posts
- Joined: 3月 2010
- Offline
- andrewlowell
- 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?
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?
- andrewlowell
- 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]
https://wordpress.discretization.de/houdini/home/advanced-2/installing-and-using-scipy-in-houdini/ [wordpress.discretization.de]
- bradcarvey
- Member
- 52 posts
- Joined: 7月 2013
- Offline
- andrewlowell
- 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]
https://vimeo.com/549462315 [vimeo.com]
- Alex Amos
- Member
- 28 posts
- Joined: 6月 2019
- Offline
- MikasSadas
- 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