Tkinter based renderer fails on jupyter running remotely
Hi,
when executing the flatland rendering inside a jupyter notebook that is running on a remote host, the import of RenderRool fails with the following error message:
---------------------------------------------------------------------------
TclError Traceback (most recent call last)
<ipython-input-1-942983ccfa4e> in <module>
5 from flatland.envs.observations import TreeObsForRailEnv
6 from flatland.envs.rail_env import RailEnv
----> 7 from flatland.utils.rendertools import RenderTool
/opt/conda/lib/python3.7/site-packages/flatland/utils/rendertools.py in <module>
7 from recordtype import recordtype
8
----> 9 from flatland.utils.graphics_pil import PILGL, PILSVG
10
11
/opt/conda/lib/python3.7/site-packages/flatland/utils/graphics_pil.py in <module>
33
34
---> 35 class PILGL(GraphicsLayer):
36 # tk.Tk() must be a singleton!
37 # https://stackoverflow.com/questions/26097811/image-pyimage2-doesnt-exist
/opt/conda/lib/python3.7/site-packages/flatland/utils/graphics_pil.py in PILGL()
36 # tk.Tk() must be a singleton!
37 # https://stackoverflow.com/questions/26097811/image-pyimage2-doesnt-exist
---> 38 window = tk.Tk()
39
40 def __init__(self, width, height, jupyter=False):
/opt/conda/lib/python3.7/tkinter/__init__.py in __init__(self, screenName, baseName, className, useTk, sync, use)
2021 baseName = baseName + ext
2022 interactive = 0
-> 2023 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
2024 if useTk:
2025 self._loadtk()
TclError: no display name and no $DISPLAY environment variable
The problem is Tkinter which depends on the presence of a local display which, in case of a server-based installation is not available.