Hello!
I’m trying to install some Python libraries in Houdini on MacOS. I’ve watched the Entagma tutorial, but it only shows how to install it for Windows and after trying to follow it on my computer it didn’t work. I’ve tried editing the PYTHONPATH variable in the bash.profile file and houdini.env, I’ve tried creating a JSON file in the packages folder with the variable, … still no luck 😅 I'm basically grasping for straws at this point.
Have any of you installed Python libraries on MacOS? If so, how did you do it?
Thanks!
Installing Python libraries on MacOS
3998 5 1-
- charlesnyiha
- Member
- 1 posts
- Joined: April 2017
- Offline
-
- tshead2
- Member
- 37 posts
- Joined: Aug. 2018
- Offline
Here's how I do it:
* In a new Houdini session, use Windows > Python Shell to open the console. Note the Python version (3.7.4 in my case), which is provided by the operating system.
* Use miniconda - https://docs.conda.io/en/latest/miniconda.html [docs.conda.io] - to create a Conda Python installation in your home directory (~/miniconda in my case).
* Use the conda package manager to create an environment with the same Python version as Houdini (I called my environment "python37").
* Activate the new environment.
* Use conda and/or pip to install Python packages you want to use in Houdini.
* In Houdini.env, point your PYTHONPATH to the site packages-directory for your new environment:
PYTHONPATH = "/Users/yourusername/miniconda3/envs/python37/lib/python3.7/site-packages"
This way, you have a nice, sandboxed environment, just for Houdini, that won't be altered by OS or other upgrades.
Cheers,
Tim
* In a new Houdini session, use Windows > Python Shell to open the console. Note the Python version (3.7.4 in my case), which is provided by the operating system.
* Use miniconda - https://docs.conda.io/en/latest/miniconda.html [docs.conda.io] - to create a Conda Python installation in your home directory (~/miniconda in my case).
* Use the conda package manager to create an environment with the same Python version as Houdini (I called my environment "python37").
* Activate the new environment.
* Use conda and/or pip to install Python packages you want to use in Houdini.
* In Houdini.env, point your PYTHONPATH to the site packages-directory for your new environment:
PYTHONPATH = "/Users/yourusername/miniconda3/envs/python37/lib/python3.7/site-packages"
This way, you have a nice, sandboxed environment, just for Houdini, that won't be altered by OS or other upgrades.
Cheers,
Tim
-
- d2h
- Member
- 19 posts
- Joined: Oct. 2020
- Offline
Not sure this is quite answering the question, but: I have a bunch of my own Python scripts that I use in Houdini on Mac as a module. The .py files live in some random location on my Mac. To make them importable as a module in Houdini, I created a symbolic link to my scripts folder, so that the scripts folder looks like it exists at this location:
With that in place, I canin Houdini, even though the module files don't really live in that folder.
To create the symbolic link, I did this in Terminal.app:
Hope that helps!
– Dave
~/Library/Preferences/houdini/19.0/python3.7libs/mymodulename
With that in place, I can
import mymodulename
To create the symbolic link, I did this in Terminal.app:
ln -s /path/to/my/python/scripts/folder ~/Library/Preferences/houdini/19.0/python3.7libs/mymodulename
Hope that helps!
– Dave
Edited by d2h - June 29, 2022 10:05:17
-
- James_Ring
- Member
- 1 posts
- Joined: May 2023
- Offline
-
- edward
- Member
- 8053 posts
- Joined: July 2005
- Online
-
- tshead2
- Member
- 37 posts
- Joined: Aug. 2018
- Offline
James_Ring
Hello,
I have been trying the method suggested by tshead2 and it does not seem to work anymore. Has anyone found a new solution or is it possible that I am just doing this incorrectly?
Yeah, my old advice is outdated, things have gotten much simpler / more consistent between platforms lately. On Windows and macOS, you should be able to do the same thing:
* Start Houdini.
* Choose Windows > Shell to open a shell window that already has PATH pointing to the Houdini CLI tools.
* Use
hython -m pip install <package>
Note that you’ll have to do this for *every* version of Houdini you install.
You may get warnings about outdated versions of pip … if so, it’s safe to follow the instructions to update it, as pip is just another installed package.
Cheers,
Tim
-
- Quick Links