Python bindings crash when matplotlib is also used
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 38/100
研究方向
未指定任何儲存庫檔案或測試。首先在回報的 macOS 設定上執行所提供的六種排列,並比較 Polyscope 和 matplotlib 的初始化及顯示行為。當這些組合不再當機,且視窗行為符合預期順序時,即視為完成。
由索引模型根據 Issue 內容生成。
描述
Polyscope's python bindings seem to interact strangely when matplotlib is also used. Here's a simple reproducing example:
import numpy as np
import polyscope as ps
import matplotlib.pyplot as plt
points_numpy = np.random.random((10,2))
# (1) Polyscope init
ps.init()
ps.register_point_cloud("my points", points_numpy)
# (2) Polyscope show
ps.show()
# (3) Matplotlib init
fig_samples = plt.figure()
ax_samples = plt.axes()
ax_samples.scatter(points_numpy[:, 0], points_numpy[:, 1])
ax_samples.set_aspect("equal")
# (4) Matplotlib show
plt.show()
I numbered the code sections to describe the different permutations. There are only 4!/(2!2!)=6 valid permutations so it's not too bad to just enumerate all of them.
If polyscope is initialized first (i.e., (1,2,3,4) or (1,3,2,4) or (1,3,4,2)), it mostly works fine. If polyscope is shown first, it'll still hang around after the close button is clicked and the matplotlib figure is still open, but other than that it works how I'd expect.
Now if matplotlib is initialized first, we run into problems. The order (3,4,1,2) also works fine, but (3,1,2,4) or (3,1,4,2) both cause the program to crash. Here's the output (I'm running this on an M1 Mac, macOS 13.3.1):
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 4.1 Metal - 83.1
2023-05-17 14:51:11.989 python3[2529:119090] *** Assertion failure in -[NSApplication run], NSApplication.m:3398
2023-05-17 14:51:11.991 python3[2529:119090] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSApp with wrong _running count'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff812e70be2 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff81299875c objc_exception_throw + 48
2 Foundation 0x00007ff813ca6eb8 -[NSCalendarDate initWithCoder:] + 0
3 AppKit 0x00007ff815ddbddf -[NSApplication run] + 881
4 _macosx.cpython-38-darwin.so 0x000000010c958472 show + 162
5 python3.8 0x00000001000a9962 cfunction_vectorcall_NOARGS + 98
6 python3.8 0x000000010017724c _PyEval_EvalFrameDefault + 48828
7 python3.8 0x0000000100048e3d _PyFunction_Vectorcall + 429
8 python3.8 0x000000010017724c _PyEval_EvalFrameDefault + 48828
9 python3.8 0x00000001000492be _PyFunction_Vectorcall + 1582
10 python3.8 0x000000010004fba7 method_vectorcall + 471
11 python3.8 0x00000001001757cf _PyEval_EvalFrameDefault + 42047
12 python3.8 0x00000001000492be _PyFunction_Vectorcall + 1582
13 python3.8 0x000000010017724c _PyEval_EvalFrameDefault + 48828
14 python3.8 0x0000000100169427 _PyEval_EvalCodeWithName + 727
15 python3.8 0x00000001001e0c48 run_mod + 168
16 python3.8 0x00000001001df775 pyrun_file + 133
17 python3.8 0x00000001001df320 pyrun_simple_file + 464
18 python3.8 0x00000001001df125 PyRun_SimpleFileExFlags + 53
19 python3.8 0x000000010020471e pymain_run_file + 286
20 python3.8 0x0000000100203f10 pymain_run_python + 416
21 python3.8 0x0000000100203d25 Py_RunMain + 37
22 python3.8 0x0000000100019558 main + 56
23 dyld 0x000000020050641f start + 1903
)
libc++abi: terminating due to uncaught exception of type NSException
I'm not sure if this is a polyscope issue, a matplotlib issue, or a combination of both, but it's perhaps something to look into. Thanks!
- 主要語言
- C++
- 星號
- 2.2k
- 分支
- 242
- 平均合併
- 11 分鐘
- 30 天內合併 PR
- 1
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nmwsharp/polyscope 的其他 Issue
-
難度 5/5 一週以上 新手友好度 35/100
-
難度 3/5 1-2 天 新手友好度 48/100
-
難度 5/5 一週以上 新手友好度 30/100
-
Rust Version 未關閉
難度 5/5 一週以上 新手友好度 15/100
-
enhancement
難度 5/5 一週以上 新手友好度 20/100
查看 nmwsharp/polyscope 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
-
good first issue
難度 2/5 1-3 小時 新手友好度 75/100
ros2/message_filters#338 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
subsurface/subsurface#4984 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
google-ai-edge/LiteRT-LM#3739 ·