google-deepmind / google-deepmind/dm_control

[viewer] Importing viewer module on macos immediately kills maplotlib windows

Đang mở
#377 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
4.7k
Fork
764
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

On MacOS, importing the viewer module from `dm_control` immediately kills the `matplotlib` plot figures even when it should be ideally blocked with plt.show(). To reproduce the issue run the code below as a script:

```python
import matplotlib
import matplotlib.pyplot as plt

from dm_control import viewer

if __name__ == '__main__':
print(f"Matplotlib backed {matplotlib.get_backend()} ")
plt.plot()
plt.show(block=True)
```

**NOTE** : To reproduce the bug from the above script make sure that backend used by matplotlib (printed on the terminal) is `MacOSX`. When using other non default backends on MacOS the issue goes away.

Looking into it I found that the issue comes from https://github.com/deepmind/dm_control/blob/3c67a42d021b97808fcc075c0c468d78f0c2233f/dm_control/_render/glfw_renderer.py#L28 Seems like having glfw.init() run globally is the cause.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.