mitsuba-renderer/mitsuba-blender

Installation: Blender crash after installing with pip

DoeringChristian opened this issue · 17 comments

Hi,
blender is crashing after I installed mitsuba via the "install dependencies using pip" button.
The error I get in the command line is:

munmap_chunk(): invalid pointer
[1]    6518 IOT instruction (core dumped)  ./blender

, crash log
At any further launch of blender I get the following error:

Writing: /tmp/blender.crash.txt
[1]    6723 segmentation fault (core dumped)  ./blender

, crash log

To Reproduce
Steps to reproduce the behavior:

  1. Download blender 3.3 and run it
  2. Download latest release of mitsuba-blender (9d9a4cb) and install it
  3. Install mitsuba using the button "install dependencies using pip"
  4. Blender crashes

Resources
If applicable, add screenshots or other files (Blender projects, Mitsuba scenes) to help explain or demonstrate your problem.

Environment (please complete the following information):

  • OS: Linux (Fedora 36)
  • Blender Version: 3.3.0, 3.2.2, 2.93.10
  • Add-on Version: latest (9d9a4cb)

Thanks for your help.

Similar issue on 3.4 too

free(): invalid pointer

Same issue. I did some digging. The bug is coming from import drjit.drjit_ext as drjit_ext when importing drjit and mitsuba
Is there a way to generate more debugging info?

Hello,

From the crash log, it seems that the installation is successful but importing drjit fails (as mentioned by @arpit15). Are you able to print the versions of the mitsuba and drjit pip packages? To do that:

  1. Open a terminal and navigate to your Blender directory. Then navigate to 3.3/python/bin. It should contain a Python executable.
  2. Then run ./(your Python executable) -m pip list.
  3. Report the version of the mitsuba and drjit packages.

Then, as a sanity check could you try to import mitsuba in the interactive console? You can start the console by executing the previously mentioned Python executable.

Cheers!

I am using custom build(121a637d) of mitsuba. I am able to import mitsuba and drjit in the interactive python console. However, I am unable to import it inside blender's scripting interactive shell.

This PR should include the full stacktrace of exceptions that occur when trying to import mitsuba. Can you let me know what gets printed out ?

Also, @arpit15 regarding your comment; your issue seems unrelated to the pip version. Do you think it would be useful to open another issue detailing your specific use case ?

Thanks!

@ros-dorian I have created another issue #41 for custom builds. However, I also face the problem when installing mitsuba from pip. The plugin was working fine with mitsuba 3.0.1

Hi @ros-dorian,
I have verified the mitsuba (3.0.2) and drjit (0.2.2) versions with blenders pyrhon executable. I am also able to import and use mitsuba (rendering the cornell box).

@ros-dorian Even with your PR, there is no extra info being printed apart from the following info

free(): invalid pointer
Aborted (core dumped)

The bug is happening in the loading of drjit_ext dynamic library in drjit.

Sounds like this issue could be related to those two commits in Dr.Jit: 09ba9df, 8e73de0.
@arpit15 it would be great if you could try to remove those couple lines in drjit/__init__.py to see whether this solves the issue. Unfortunately I cannot reproduce this bug on my side.

I am able to import mitsuba and drjit in the interactive python console.

@arpit15 is this the interactive python console within Blender, or just in a regular terminal?

I removed _sys.setdlopenflags flags while loading drjit. I was able to move forward.

But then I faced the same issue in loading mitsuba. So I removed the same flags in mitsuba's __init__.py as well.

I am getting following error now from this line

free(): invalid pointer
Aborted (core dumped)

I am able to import mitsuba and drjit in the interactive python console.

@arpit15 is this the interactive python console within Blender, or just in a regular terminal?

I am able to import in the python console outside of Blender. I face the same crash bug as mentioned above, if I try to import mitsuba from within Blender.

@arpit15 The problematic line is only needed in order to make the built-in renderer work. As it is not currently functioning anyway, you can safely comment it. Let us know if it improves the situation.

I was facing problems, even after removing those lines. I commented out dlopen flags lines in mitsuba import as well. I am now able to open blender with plugin loaded.
However, it crashes when I try to export or import scenes. But the bugs are unrelated to this post. I will open other issues, with test cases later for those bugs.

@arpit15 the crash comes from the fact that the dynamic loading of the plugin DLLs also use the RTLD_DEEPBIND flag internally. I have been working on a work-around for this issue today, hopefully will be able to push this in the coming days (then we will also need to wait for the next release).

Temporaly if you are compiling Mitsuba locally, you can edit the plugin.cpp file and remove the usage of the RTLD_DEEPING flag. This is only really necessary when working with PyTorch and Mitsuba in the same Python script.

The PR #44 should fix the original issue @DoeringChristian (crash after installing with pip). Let me know if that works for you. Basically, the add-on will ask you to install a specific version of Mitsuba which is validated with the latest version of the add-on.

I can confirm it is working now. The plugin downloaded mitsuba v3.0.1, the only supported version. Can I assume that v3.0.3 will also be supported once it is out? There are also some issues I have rendering with mitsuba v3.0.1 in blender, there is nothing being rendered in the viewport as well as the render view.
Thanks for fixing the problem finally I can export blender scenes to mitsuba files again.

Thanks for the confirmation, I will now close this issue.

Unfortunately, the rendering part of the add-on is not yet implemented and you currently need to export the scene and render using the command-line interface of Mitsuba. Hopefully, this feature will be available soon!