-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jupyter Kernel dies while trying to run Mitsuba python code #515
Comments
Hi @jojo96 , Does this also happen if you run the same code in a simple Python script? |
Hi @jojo96, Does adding mitsuba2/include/mitsuba/render/film.h Lines 25 to 26 in 4e7628c
I believe it's required before calls to |
Hi @Speierers "" Thread.thread().file_resolver().append(os.path.dirname(filename)) film = sensor.film() from mitsuba.core import Bitmap, Struct But the thing is that there is no image called final _image saved at my location 'C:\Users\Jojo\Downloads\final_image.jpg'. This did not happen when the Jupyter notebook was running earlier. |
Hi @merlinND I am not sure how to use film.prepare(channels). Tried this but getting an error: " Originally, I followed the documentation: https://mitsuba2.readthedocs.io/en/latest/src/python_interface/rendering_scene.html and prepared the script. There was no mention to film.prepare(channels) there |
Hi @jojo96, If you check out the signature of In the documentation you linked, before
which prepares the film: mitsuba2/src/librender/integrator.cpp Lines 70 to 73 in 4e7628c
|
@merlinND I tried to put the line: But the notebook goes on running indefinitely. Earlier, I could just render fine without this line. |
If it goes on running "indefinitely", first try with low resolution and spp. As @Speierers suggested, it's good to run these tests in simple Python scripts.
How were you rendering before? From the code you posted at the top, I don't see any rendering taking place: import mitsuba
import os
mitsuba.set_variant('scalar_rgb')
from mitsuba.core import *
from mitsuba.core.xml import load_file
filename = r'D:\mitsuba2\resources\data\scenes\cbox\shapeTest2.xml'
Thread.thread().file_resolver().append(os.path.dirname(filename))
scene = load_file(filename)
sensor = scene.sensors()[0]
film = sensor.film()
film.set_destination_file(r'C:\Users\u0148719\ou.exr')
film.develop() The |
You were right. I missed the integrator.render(). Now, I prepared a simple Python file: import mitsuba
import os
mitsuba.set_variant('scalar_rgb')
from mitsuba.core import Thread
from mitsuba.core.xml import load_file
filename = r'D:\mitsuba2\resources\data\scenes\cbox\shapeTest2.xml'
Thread.thread().file_resolver().append(os.path.dirname(filename))
scene = load_file(filename)
sensor = scene.sensors()[0]
scene.integrator().render(scene, sensor)
film = sensor.film()
film.set_destination_file(r'C:\Users\Jojo\Downloads\ou.exr')
film.develop()
from mitsuba.core import Bitmap, Struct
img = film.bitmap(raw=True).convert(Bitmap.PixelFormat.RGB, Struct.Type.UInt8, srgb_gamma=True)
img.write(r'C:\Users\Jojo\Downloads\test.jpg') I ran it from the command line and the rgb image 'test.jpg' is produced. But still can't make it run from Jupyter notebook :( |
I suppose it is failing at a specific line in the code above? |
@Speierers it fails at scene.integrator().render(scene, sensor) |
I will need your scene file to test this on my end. Or is this happening with any scenes? |
This is just happening with any scene. |
Can you try with |
Hi, it's now working with both raw = True and raw = False. I have no idea why Jupyter notebook keeps breaking from time to time.. |
Not sure to understand how you've got it to work now. So should we keep investigating this? |
Summary
I was trying to run Mitsuba in Jupyter notebook. I tried the following code:
import mitsuba
import os
mitsuba.set_variant('scalar_rgb')
from mitsuba.core import *
from mitsuba.core.xml import load_file
filename = r'D:\mitsuba2\resources\data\scenes\cbox\shapeTest2.xml'
Thread.thread().file_resolver().append(os.path.dirname(filename))
scene = load_file(filename)
sensor = scene.sensors()[0]
film = sensor.film()
film.set_destination_file(r'C:\Users\u0148719\ou.exr')
film.develop()
Whenever I use the command film.develop(), my kernel dies! It was working before in my other laptop.
System configuration
For bug report, please enter information regarding your system configuration<- [remove this]
scalar_rgb
Description
Jupyter Kernel dies when trying to compile Mitsuba code. The whole code is given above.
The error log from Jupyter terminal:
[I 18:45:17.359 NotebookApp] Creating new notebook in
[I 18:45:21.818 NotebookApp] Kernel started: 367aef11-1840-4f81-bf08-b03766ca876e, name: python3
[I 18:47:22.696 NotebookApp] Saving file at /Untitled.ipynb
[I 18:49:22.655 NotebookApp] Saving file at /Untitled.ipynb
[I 18:51:12.811 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel 367aef11-1840-4f81-bf08-b03766ca876e restarted
[I 18:51:21.799 NotebookApp] Saving file at /Untitled.ipynb
[I 18:51:32.172 NotebookApp] Saving file at /Untitled.ipynb
[I 18:52:21.832 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel 367aef11-1840-4f81-bf08-b03766ca876e restarted
[I 18:52:32.060 NotebookApp] Starting buffering for 367aef11-1840-4f81-bf08-b03766ca876e:4d794398fdfd471c8bfebe02d2174901
[I 18:52:32.407 NotebookApp] Kernel restarted: 367aef11-1840-4f81-bf08-b03766ca876e
[I 18:52:32.442 NotebookApp] Restoring connection for 367aef11-1840-4f81-bf08-b03766ca876e:4d794398fdfd471c8bfebe02d2174901
[I 18:52:34.015 NotebookApp] Replaying 3 buffered messages
[I 18:52:44.409 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel 367aef11-1840-4f81-bf08-b03766ca876e restarted
[I 18:53:22.682 NotebookApp] Saving file at /Untitled.ipynb
[I 18:58:14.439 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel 367aef11-1840-4f81-bf08-b03766ca876e restarted
Steps to reproduce
The text was updated successfully, but these errors were encountered: