google-deepmind / google-deepmind/dm_control

NSInternalInconsistencyException When Using mjpython With composer.Environment on M1 Macbook

Abierto
#493 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
4.7k
Forks
764
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hello,

In order to use mujoco.passive_viewer on my m1 macbook [I have to use `mjpython` command to launch it.
](https://github.com/google-deepmind/mujoco/discussions/780)

But when I try to create an environment as follows

```
env = composer.Environment(task=task, time_limit=time_limit, **env_kwargs)
```
Launching this with `mjpython` results in the following error

```
2024-09-14 14:15:19.365 mjpython[93348:387515] *** 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 0x00000001bfead198 __exceptionPreprocess + 240
1 libobjc.A.dylib 0x00000001bfbf7e04 objc_exception_throw + 60
2 CoreFoundation 0x00000001bfed8118 _CFBundleGetValueForInfoKey + 0
3 AppKit 0x00000001c29baba0 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 372
4 AppKit 0x00000001c29a5b9c -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 948
5 AppKit 0x00000001c29a57dc -[NSWindow initWithContentRect:styleMask:backing:defer:] + 56
6 libglfw.3.dylib 0x00000001052ad710 _glfwPlatformCreateWindow + 336
7 libglfw.3.dylib 0x00000001052a7bc8 glfwCreateWindow + 332
8 libffi.8.dylib 0x000000010499004c ffi_call_SYSV + 76
9 libffi.8.dylib 0x000000010498d74c ffi_call_int + 1208
10 _ctypes.cpython-310-darwin.so 0x0000000104970a1c _ctypes_callproc + 1260
11 _ctypes.cpython-310-darwin.so 0x000000010496acfc PyCFuncPtr_call + 1132
12 python3.10 0x0000000104e4b59c _PyObject_MakeTpCall + 612
13 python3.10 0x0000000104f3d5d8 call_function + 676
14 python3.10 0x0000000104f38e60 _PyEval_EvalFrameDefault + 24940
15 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
16 python3.10 0x0000000104f3d540 call_function + 524
17 python3.10 0x0000000104f39430 _PyEval_EvalFrameDefault + 26428
18 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
19 python3.10 0x0000000104e4edc0 method_vectorcall + 520
20 python3.10 0x0000000104f39658 _PyEval_EvalFrameDefault + 26980
21 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
22 python3.10 0x0000000104f3d540 call_function + 524
23 python3.10 0x0000000104f38e38 _PyEval_EvalFrameDefault + 24900
24 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
25 python3.10 0x0000000104e4ec64 method_vectorcall + 172
26 python3.10 0x0000000104f3d540 call_function + 524
27 python3.10 0x0000000104f38e60 _PyEval_EvalFrameDefault + 24940
28 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
29 python3.10 0x0000000104e4b7ac _PyObject_FastCallDictTstate + 156
30 python3.10 0x0000000104e4c454 _PyObject_Call_Prepend + 176
31 python3.10 0x0000000104ec3394 slot_tp_init + 116
32 python3.10 0x0000000104ebbd64 type_call + 456
33 python3.10 0x0000000104e4b59c _PyObject_MakeTpCall + 612
34 python3.10 0x0000000104f3d5d8 call_function + 676
35 python3.10 0x0000000104f39430 _PyEval_EvalFrameDefault + 26428
36 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
37 python3.10 0x0000000104f3d540 call_function + 524
38 python3.10 0x0000000104f38e38 _PyEval_EvalFrameDefault + 24900
39 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
40 python3.10 0x0000000104e57f80 property_descr_get + 128
41 python3.10 0x0000000104ea4a74 _PyObject_GenericGetAttrWithDict + 208
42 python3.10 0x0000000104ea548c PyObject_GetAttr + 96
43 python3.10 0x0000000104f3754c _PyEval_EvalFrameDefault + 18520
44 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
45 python3.10 0x0000000104e4b7ac _PyObject_FastCallDictTstate + 156
46 python3.10 0x0000000104e4c454 _PyObject_Call_Prepend + 176
47 python3.10 0x0000000104ec3394 slot_tp_init + 116
48 python3.10 0x0000000104ebbd64 type_call + 456
49 python3.10 0x0000000104e4b59c _PyObject_MakeTpCall + 612
50 python3.10 0x0000000104f3d5d8 call_function + 676
51 python3.10 0x0000000104f39430 _PyEval_EvalFrameDefault + 26428
52 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
53 python3.10 0x0000000104e4ec64 method_vectorcall + 172
54 python3.10 0x0000000104f3d540 call_function + 524
55 python3.10 0x0000000104f39430 _PyEval_EvalFrameDefault + 26428
56 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
57 python3.10 0x0000000104f3d540 call_function + 524
58 python3.10 0x0000000104f38e60 _PyEval_EvalFrameDefault + 24940
59 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
60 python3.10 0x0000000104f3d540 call_function + 524
61 python3.10 0x0000000104f38e38 _PyEval_EvalFrameDefault + 24900
62 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
63 python3.10 0x0000000104f3d540 call_function + 524
64 python3.10 0x0000000104f38e38 _PyEval_EvalFrameDefault + 24900
65 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
66 python3.10 0x0000000104e4ec64 method_vectorcall + 172
67 python3.10 0x0000000104f3d540 call_function + 524
68 python3.10 0x0000000104f39430 _PyEval_EvalFrameDefault + 26428
69 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
70 python3.10 0x0000000104e4b7ac _PyObject_FastCallDictTstate + 156
71 python3.10 0x0000000104e4c454 _PyObject_Call_Prepend + 176
72 python3.10 0x0000000104ec3394 slot_tp_init + 116
73 python3.10 0x0000000104ebbd64 type_call + 456
74 python3.10 0x0000000104e4bfb0 _PyObject_Call + 148
75 python3.10 0x0000000104f39658 _PyEval_EvalFrameDefault + 26980
76 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
77 python3.10 0x0000000104f3d540 call_function + 524
78 python3.10 0x0000000104f39430 _PyEval_EvalFrameDefault + 26428
79 python3.10 0x0000000104f32364 _PyEval_Vector + 2036
80 python3.10 0x0000000104f8d398 run_mod + 216
81 python3.10 0x0000000104f8ce38 _PyRun_SimpleFileObject + 1260
82 python3.10 0x0000000104f8be1c _PyRun_AnyFileObject + 240
83 python3.10 0x0000000104fb08f8 Py_RunMain + 2340
84 mjpython 0x000000010479e940 _ZN12_GLOBAL__N_115mjpython_pymainEPv + 160
85 libsystem_pthread.dylib 0x00000001bfd6026c _pthread_start + 148
86 libsystem_pthread.dylib 0x00000001bfd5b08c thread_start + 8
)
libc++abi: terminating with uncaught exception of type NSException
[1] 93348 abort mjpython
```

This only occurs when using `mjpython`, a requirement for my script, where I use the passive viewer to view and interact with the environment.

```
with mujoco.viewer.launch_passive(
self._env.physics.model.ptr, self._env.physics.data.ptr, show_right_ui=False
) as viewer:
while viewer.is_running():
if self._reset_step:
ts = self._env.reset()
self._reset_step = False

step_start = time.time()

ts = self._env.step(self._joint_cmd)
self._joint_state = ts.observation["joint_positions"]
...

Would appreciate any workarounds or advice!

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.