krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
377 stars 96 forks source link

Visualization error on MacOS #176

Closed alexanderdsmith closed 11 months ago

alexanderdsmith commented 11 months ago

Testing visualization in Klamp't on MacOS 11.6 with an Intel processor MacBook Pro results in the following exception:

vis: creating GL window 2023-12-04 22:23:02.231 Python[47329:6465043] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' First throw call stack: ( 0 CoreFoundation 0x00007fff2067c1db exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff203b5d92 objc_exception_throw + 48 2 CoreFoundation 0x00007fff206a48e6 -[NSException raise] + 9 3 AppKit 0x00007fff22e33eb2 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 321 4 AppKit 0x00007fff22e1eaa2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1296 5 AppKit 0x00007fff22e1e58b -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42 6 AppKit 0x00007fff2312883c -[NSWindow initWithContentRect:styleMask:backing:defer:screen:] + 52 7 libqcocoa.dylib 0x000000014530d312 qt_plugin_instance + 196690 8 libqcocoa.dylib 0x00000001452f8c88 qt_plugin_instance + 113096 9 libqcocoa.dylib 0x00000001452f1bd2 qt_plugin_instance + 84242 10 libqcocoa.dylib 0x00000001452f1646 qt_plugin_instance + 82822 11 QtGui 0x000000013be6b7f2 _ZN14QWindowPrivate6createEby + 146 12 QtOpenGL 0x000000013cebdb8f ZN10QGLContext13chooseContextEPKS + 271 13 QtOpenGL 0x000000013cebd899 ZN10QGLContext6createEPKS + 57 14 QtOpenGL 0x000000013cebe9b3 _ZN9QGLWidget10setContextEP10QGLContextPKS0_b + 147 15 QtOpenGL 0x000000013cec0c96 _ZN16QGLWidgetPrivate11initContextEP10QGLContextPK9QGLWidget + 118 16 QtOpenGL.abi3.so 0x000000013ce8fb17 _ZL19init_type_QGLWidgetP17_sipSimpleWrapperP7_objectS2_PS2_S3S3 + 663 17 sip.cpython-311-darwin.so 0x000000013ca6e8af sipSimpleWrapper_init + 495 18 Python 0x0000000107c57dbc wrap_init + 12 19 Python 0x0000000107bd9190 wrapperdescr_call + 416 20 Python 0x0000000107bc9841 _PyObject_MakeTpCall + 129 21 Python 0x0000000107cf75c7 _PyEval_EvalFrameDefault + 60471 22 Python 0x0000000107cfd690 _PyEval_Vector + 128 23 Python 0x0000000107bc9b00 _PyObject_FastCallDictTstate + 96 24 Python 0x0000000107c57bf5 slot_tp_init + 181 25 Python 0x0000000107c4dd9a type_call + 122 26 Python 0x0000000107bc9841 _PyObject_MakeTpCall + 129 27 Python 0x0000000107cf75c7 _PyEval_EvalFrameDefault + 60471 28 Python 0x0000000107cfd690 _PyEval_Vector + 128 29 Python 0x0000000107bcdcb6 method_vectorcall + 454 30 Python 0x0000000107cfa70a _PyEval_EvalFrameDefault + 73082 31 Python 0x0000000107cfd690 _PyEval_Vector + 128 32 Python 0x0000000107bcdcb6 method_vectorcall + 454 33 Python 0x0000000107e05cf6 thread_run + 230 34 Python 0x0000000107d81154 pythread_wrapper + 36 35 libsystem_pthread.dylib 0x00007fff2050a8fc _pthread_start + 224 36 libsystem_pthread.dylib 0x00007fff20506443 thread_start + 15 ) libc++abi: terminating with uncaught exception of type NSException zsh: abort python3 atlas-ui.py alexandersmith@Als-MacBook atlas % ls =20.3 atlas-ui.py atlas_controller.py dicom_read.py robots test_registration2.py MACOSX atlas.py atlas_mri.py edt.py segmentations testserver.py pycache atlas.xml atlas_tumor.py head_ct test_klampt.py atlas-gui atlas_calibration.py create_world.py neurobotics test_registration.py alexandersmith@Als-MacBook atlas % python3 atlas_tumor.py RobParser: Reading robot file robots/robV5/V5.rob... RobParser: Parsing robot file, 13 links read... RobParser: Loaded geometries in time 0.218743s, 16150 total primitive elements RobParser: Done loading robot file robots/robV5/V5.rob ManagedGeometry: loaded segmentations/ventricles_segmentation.stl in time 0.950732s klampt.vis: using Qt5 as the visualization backend Initialized rigid object segmentations/ventricles_segmentation.stl collision data structures in time 0.640841s QtBackend: initializing app as Klamp't visualization WARNING: QApplication was not created in the main() thread. Baselink: [0.003069, -0.004931, 0.005243] vis: creating GL window 2023-12-04 22:23:45.299 Python[47355:6466580] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' First throw call stack: ( 0 CoreFoundation 0x00007fff2067c1db __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff203b5d92 objc_exception_throw + 48 2 CoreFoundation 0x00007fff206a48e6 -[NSException raise] + 9 3 AppKit 0x00007fff22e33eb2 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 321 4 AppKit 0x00007fff22e1eaa2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1296 5 AppKit 0x00007fff22e1e58b -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42 6 AppKit 0x00007fff2312883c -[NSWindow initWithContentRect:styleMask:backing:defer:screen:] + 52 7 libqcocoa.dylib 0x0000000143e41312 qt_plugin_instance + 196690 8 libqcocoa.dylib 0x0000000143e2cc88 qt_plugin_instance + 113096 9 libqcocoa.dylib 0x0000000143e25bd2 qt_plugin_instance + 84242 10 libqcocoa.dylib 0x0000000143e25646 qt_plugin_instance + 82822 11 QtGui 0x0000000142b167f2 _ZN14QWindowPrivate6createEby + 146 12 QtOpenGL 0x000000013a79eb8f ZN10QGLContext13chooseContextEPKS + 271 13 QtOpenGL 0x000000013a79e899 ZN10QGLContext6createEPKS + 57 14 QtOpenGL 0x000000013a79f9b3 _ZN9QGLWidget10setContextEP10QGLContextPKS0_b + 147 15 QtOpenGL 0x000000013a7a1c96 _ZN16QGLWidgetPrivate11initContextEP10QGLContextPK9QGLWidget + 118 16 QtOpenGL.abi3.so 0x000000013a770b17 _ZL19init_type_QGLWidgetP17_sipSimpleWrapperP7_objectS2_PS2_S3S3 + 663 17 sip.cpython-311-darwin.so 0x000000013a7438af sipSimpleWrapper_init + 495 18 Python 0x0000000106765dbc wrap_init + 12 19 Python 0x00000001066e7190 wrapperdescr_call + 416 20 Python 0x00000001066d7841 _PyObject_MakeTpCall + 129 21 Python 0x00000001068055c7 _PyEval_EvalFrameDefault + 60471 22 Python 0x000000010680b690 _PyEval_Vector + 128 23 Python 0x00000001066d7b00 _PyObject_FastCallDictTstate + 96 24 Python 0x0000000106765bf5 slot_tp_init + 181 25 Python 0x000000010675bd9a type_call + 122 26 Python 0x00000001066d7841 _PyObject_MakeTpCall + 129 27 Python 0x00000001068055c7 _PyEval_EvalFrameDefault + 60471 28 Python 0x000000010680b690 _PyEval_Vector + 128 29 Python 0x00000001066dbcb6 method_vectorcall + 454 30 Python 0x000000010680870a _PyEval_EvalFrameDefault + 73082 31 Python 0x000000010680b690 _PyEval_Vector + 128 32 Python 0x00000001066dbcb6 method_vectorcall + 454 33 Python 0x0000000106913cf6 thread_run + 230 34 Python 0x000000010688f154 pythread_wrapper + 36 35 libsystem_pthread.dylib 0x00007fff2050a8fc _pthread_start + 224 36 libsystem_pthread.dylib 0x00007fff20506443 thread_start + 15 ) libc++abi: terminating with uncaught exception of type NSException zsh: abort python3 atlas_tumor.py

krishauser commented 11 months ago

Please see this: http://motion.cs.illinois.edu/software/klampt/latest/pyklampt_docs/Manual-Visualization.html#multithreaded-mode-workaround-on-mac

Multithreaded visualization is prohibited on Mac, so you will need to use vis.loop() rather than vis.show().

alexanderdsmith commented 11 months ago

Just tested, thanks! Very cool to have Klamp’t work on my Mac!

@.***

Kind regards, Al

From: krishauser @.> Date: Wednesday, December 6, 2023 at 5:26 PM To: krishauser/Klampt @.> Cc: Alexander Smith @.>, Author @.> Subject: Re: [krishauser/Klampt] Visualization error on MacOS (Issue #176)

Please see this: http://motion.cs.illinois.edu/software/klampt/latest/pyklampt_docs/Manual-Visualization.html#multithreaded-mode-workaround-on-mac

Multithreaded visualization is prohibited on Mac, so you will need to use vis.loop() rather than vis.show().

— Reply to this email directly, view it on GitHubhttps://github.com/krishauser/Klampt/issues/176#issuecomment-1843110271, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZFB4DBWDPFMKQNIKMZYK3YICFBXAVCNFSM6AAAAABAGS4QTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGEYTAMRXGE. You are receiving this because you authored the thread.Message ID: @.***>