-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Issue Title
Failure to load Mitsuba module despite successful pip install due to changing search paths in Blender 4.5.
Bug Description
Mitsuba-Blender add-on fails to find Mitsuba module when running in Blender 4.5 on Windows as the mitsuba (and drjit) python packages are installed in the user-specific site-packages folder (%APPDATA%\Python\Python311\site-packages), but this folder is no longer included in the search path for Python packages as of (as far as I can tell) Blender 4.2.
To Reproduce
Steps to reproduce the behavior:
- Install add-on in Blender 4.5 on Windows
- Enable add-on and run
Install Dependencies Failed to load mitsuba moduleerror ensues despite successful installation pip log in Blender console.
Expected behavior
No error on failing to load the module.
Environment (please complete the following information):
- OS: Windows
- Blender Version: 4.5.0
- Add-on Version: 0.4.0 (the add-on version shows up as
0.1inside Blender btw)
Additional context
This can be fixed, following this thread on the Blender Stack-Exchange by additionally importing site as a module and adding the lines
user_site_pkgs = site.getusersitepackages()
if user_site_pkgs not in sys.path:
sys.path.append(user_site_pkgs)
to the init_mitsuba function which ensures that the user-site packages path is automatically included in the search path for import mitsuba.
This is the simplest solution, but modifies the package search path globally so an alternative could be to only invoke this if/when Mitsuba fails to load and then remove the path from sys.path after Mitsuba is successfully imported - might break things with dynamic reloading of packages as Mitsuba does with switching variants.