open3d crashes python kernel after closing window
Checklist
- [X] I have searched for similar issues.
- [X] For Python issues, I have tested with the latest development wheel.
- [X] I have checked the release documentation and the latest documentation (for
masterbranch).
Describe the issue
I have been using open3d.visualization.Visualizer() to plot large point clouds, around millions of dots. I get the following warning on jupyter lab:
Premature drain of QMacAutoReleasePool(0x7ff7b44d9b98) This can happen if you've allocated the pool on the heap, or as a member of a heap-allocated object. This is not a supported use of QMacAutoReleasePool, and might result in crashes when objects in the pool are deallocated and then used later on under the assumption they will be valid until QMacAutoReleasePool(0x7ff7b44d9b98) has been drained.
But everything seems to run fine until I close the visualisation window. Then python crashes and I get the following macOS report:

Steps to reproduce the bug
# I have not been able to simplify the code but I am using open3d.visualization.Visualizer() and calling update_geometry(), poll_events() and update_renderer() similarly to the non-blocking visualization example.
Error message
No response
Expected behavior
No response
Open3D, Python and System information
- Operating system: macOS 12.2.1
- Python version: Python 3.8
- Open3D version: 0.15.1
Additional information
No response
Hi @Mossi8
- Is this Apple Silicon?
- Please provide code to reproduce this, if possible. Also, specific datasets. If any point cloud of a certain size works, you can create test point clouds with Numpy.
I managed to replicate the behaviour. It crashes only when I also run the open3d code, otherwise, PyQt5 opens and closes normally.
import open3d as o3d
import numpy as np
import time
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
class Window(QWidget):
def __init__(self):
super().__init__()
self.title = 'PyQt5 button - pythonspot.com'
self.left = 10
self.top = 10
self.width = 320
self.height = 200
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
button = QPushButton('PyQt5 button', self)
button.setToolTip('This is an example button')
button.move(100,70)
button.clicked.connect(self.on_click)
self.vis = o3d.visualization.Visualizer()
self.vis.create_window(top=0,left=500)
allgenes = np.random.random_sample([1000000,3])
allcolors = np.ones([1000000, 3])*0.5#np.concatenate(colors)[:,0,:]
self.pcd = o3d.geometry.PointCloud()
self.pcd.points = o3d.utility.Vector3dVector(allgenes)
self.pcd.colors = o3d.utility.Vector3dVector(allcolors)
self.vis.add_geometry(self.pcd)
self.break_loop = False
#self.vis.run()
# Tell the application not to exit when the last window is closed. This should
# prevent the application from exiting when the message box is closed.
#self.show()
def loop_execute(self):
while True:
if self.break_loop:
break
self.vis.poll_events()
self.vis.update_renderer()
time.sleep(0.5)
@pyqtSlot()
def on_click(self):
print('PyQt5 button click')
allgenes = np.random.random_sample([10,3])
allcolors = np.ones([10, 3])*0.2#np.concatenate(colors)[:,0,:]
self.break_loop = True
self.pcd.points = o3d.utility.Vector3dVector(allgenes)
self.pcd.colors = o3d.utility.Vector3dVector(allcolors)
self.vis.update_geometry(self.pcd)
self.vis.poll_events()
self.vis.update_renderer()
self.break_loop= False
self.loop_execute()
def closeEvent(self, event):
self.break_loop = True
#self.vis.clear_geometries()
self.vis.destroy_window()
#self.vis.close()
def main():
#global app
app = QApplication(sys.argv)
w = Window()
w.show()
app.exec()
app.quit()
if __name__ == '__main__':
main()
Hello, any updates on this issue? I'm facing the same problem. Edit: I am actually only facing this problem with Jupyter Lab; I tried the same lines of code in VSCode and it worked fine.
any updates? I have the same issue with the spyder IDE