mitsuba-blender
mitsuba-blender copied to clipboard
ImportError Mitsuba2, despite the fact that the python versions (compiled and Blender) matches. Windows
Win11
- Blender 2.93 + Mitsuba-Blender (the 'next' branch)+ Mitsuba2 (compiled against Python 3.9.2, which is the version for Blender 2.93.0) = Not recognized
- Blender 2.93 + Mitsuba-Blender (the 'next' branch)+ Mitsuba2 (compiled against Python 3.9.7, which is the version for Blender 3.0.0) = Not recognized
- Blender 3.0 + Mitsuba-Blender (the 'next' branch)+ Mitsuba2 (compiled against Python 3.9.7, which is the version for Blender 3.0.0) = Not recognized
- New: according to this comment (https://github.com/mitsuba-renderer/mitsuba2-blender/issues/13#issuecomment-950897463), Blender 2.83 + Mitsuba-Blender + Mitsuba2 (compiled against Python 3.7.9, but the Blender Python is 3.7.4) should work, but it doesn't work, same problem = Not recognized
Any thoughts ?
Hello,
The next
branch is currently under development, and reflects some changes in the Mitsuba 2 API that are not yet released. I recommend using the master
branch of the addon for now, which should work with the publicly available Mitsuba 2 master
.
That being said, I couldn't reproduce your error on Windows 10 with mitsuba2-master
and mitsuba2-blender-next
. Could you please specify the commit of Mitsuba 2 you built, and also that of the addon?
Hi, thanks for your reply. for Mitsuba 2 : The branch that I used was the master one, because it is in the documentation ( https://mitsuba2.readthedocs.io/en/latest/src/getting_started/cloning.html ). As for the branch I didn't specify any commit, I used (git clone) as in the documentation.
Ps: I didn't do the ( Staying up-to-date¶ ) step, but it worked normally and I was able to render some of the examples like (cbox.xml, cbox-rgb.xml, cbox-spectral.xml) without errors. I don't think it will be related to this issue, but it is worth to mention.
As for the addon: I just downloaded the (next) branch by choosing it from the drop down list, then pressing the green (Code) button, then ( Download as zip ). I installed it like any Blender Addon zip installation.
Can you please try again with the master
branch of the addon, just to be sure ? This is the one you will have to use anyway.
Yeah sure, sorry for being late.
- Blender 3.0 + Mitsuba-Blender (the 'master' branch)+ Mitsuba2 (compiled against Python 3.9.2) = Recognized, but not working. When enabled, I can choose the folder (dst) without error.
- Blender 3.0 + Mitsuba-Blender (the 'master' branch)+ Mitsuba2 (compiled against Python 3.9.7, which is the same version as Blender 3.0 python) = Recognized, but not working. When enabled, I can choose the folder (dst) without error.
- Blender 2.83 + Mitsuba-Blender (the 'master' branch)+ Mitsuba2 (compiled against Python 3.7.9, which is the same version as Blender 2.83 python) = Recognized, but not working. When enabled, I can choose the folder (dst) without error.
Created a new scene, simple sphere with glass shader, plane with diffuse shader, area light (plane), changed the environment to hdr file.
the enabled plugin:
the console:
blender log screen:
Can you send me the (Mitsubs 2) that you have compiled, and send me also the (Mitsuba-Blender)plugin that you are using on Windows 10 so I can test if it works on my device. Although I don't think that it was a problem with my building instructions, but we can after that take it out of the equation.
Best regards
Can you import mitsuba outside of blender, i.e. in a standard python prompt? On my end I cannot import mitsuba
with the version of mitsuba compiled from master
I can not also import it.
- Outside Blender I got : Python 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information.
import mitsuba Traceback (most recent call last): File "
", line 1, in ModuleNotFoundError: No module named 'mitsuba'
- Inside Blender I got: PYTHON INTERACTIVE CONSOLE 3.9.2 (default, Mar 1 2021, 08:18:55) [MSC v.1916 64 bit (AMD64)]
Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils Convenience Imports: from mathutils import *; from math import * Convenience Variables: C = bpy.context, D = bpy.data
import mitsuba Traceback (most recent call last): File "G:\AI\mitsuba2\NewPython39\mitsuba2-392\mitsuba2\dist\python\mitsuba_init_.py", line 12, in
import('mitsuba.core_ext') File "C:\blender-2.93.5-windows-x64\2.93\python\lib\importlib_init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File " ", line 1030, in _gcd_import File " ", line 1007, in _find_and_load File " ", line 986, in _find_and_load_unlocked File " ", line 666, in _load_unlocked File " ", line 565, in module_from_spec File " ", line 1108, in create_module File " ", line 228, in _call_with_frames_removed ImportError: DLL load failed while importing core_ext: The specified module could not be found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<blender_console>", line 1, in
Did you run setpath
before importing mitsuba in the normal command prompt?
Also, I noticed you pointed to the dist
subdirectory of the build folder, but the addon expects the root of the build folder as input, so you probably want to change the path you provided to the addon to "G:\AI\mitsuba2\NewPython39\mitsuba2-392\mitsuba2
(or maybe you already did?)
I'm getting similar errors on my end, even outside of blender, I'm investigating
This seems somehow specific to blender with python 3.9. It worked on my end with blender 2.83 and compiling mitsuba with python 3.7.9.
I don't know how to setpath mitsuba in the normal command prompt. If you can give me the commands I will try it out.
As for the path, yes I tried both of them, the (dst) folder and the (mitsuba2) path, and I had the same problem.
blender 2.83 + python 3.7.9 didn't work for me, can you share the blender program and the mitsuba2 build that you have built so I can test it
There's a script setpath.bat
in the root folder of mitsuba, you can execute it to add the path to the build folder to the PYTHONPATH
and PATH
environment variables (it assumes the build folder is called build
).
Here is my build with python 3.7.9, though I don't think this will be very jelpful since the build is specific to my system.
Thanks for the build file.
- As you have said, trying to import (mitsuba2) outside of blender also didn't work after using the (setpath.bat).
- trying the addon that you kindly sent also didn't work, same problem.
I noticed in the file that you have sent that you are using the (Debug) build, shouldn't you use the (Release) build ?
You're right, but this doesn't make any difference here.
Can you run the following script with both the python executable you compiled mitsuba with, as well as blender's python? (It should be located somewhere like C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin\python.exe
)
import os, sys
build_path = r"C:\Users\bnico\Documents\Work\code\mitsuba2\build\dist"
os.environ['PATH'] = build_path + os.pathsep + os.environ['PATH']
sys.path.insert(0, os.path.join(build_path, "python"))
import mitsuba
mitsuba.set_variant("scalar_rgb")
print(mitsuba.variant())
It should simply write "scalar_rgb" in the command line.
Please run it for both blender 2.83 (python 3.7.9) and blender 3.0 (python 3.9.7). On my end there are no errors with blender 2.83, but there is one when running the script with blender 3.0's python
Correct ..
- blender 2.83 python + mitsuba2 (compiled for python 3.7.9) =
works
- python 3.7.9 that I used to compile mitsuba2 + mitsuba2 (compiled for python 3.7.9) =
works
- blender 3.0 + mitsuba2 (compiled for python 3.9.7) = doesn't work
- python 3.9.7 that I used to compile mitsuba2 + mitsuba2 (compiled for python 3.9.7) =
works !!!
Then you should be able to use the addon with blender 2.83.
Yeah I should, but I can't. Every time I try to export it shows the same error from the beginning. If you have another way of using the addon that works for you I would be happy to test it.
The latest version of the add-on now only supports Mitsuba 3 which is installed directly from PIP. If you still have an issue with using the add-on, this should fix it.