Can't import `graphics` on GPU cluster (i.e. no interactive display)
ThisIsIsaac opened this issue · 3 comments
I'm running RoutedFusion on a GPU cluster without interactive display, and I get the following error:
>>> import graphics
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/envs/depth/lib/python3.6/site-packages/graphics/__init__.py", line 185, in <module>
_root = tk.Tk()
File "/opt/conda/envs/depth/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display "gpu-cloud-node26.dakao.io:11.0"
Libraries like Matplotlib give options to change the display backend that the library uses, but there seems to be no documentation at all for graphics.
- is there a way we can change the backend used by graphics?
- If not, is there a work-around? maybe use s different library?
Hi @ThisIsIsaac,
Apologies for jumping on this so late.
A full import of graphics will cause this problems since it uses tkinter for visualization. However, RoutedFusion only imports the VoxelGrid class and does not import anything else by default. Therefore, you should not run into these problems.
from graphics import Voxelgrid
Does the same error occur for that?
Cheers!
Hi @weders , thanks for the reply.
unfortunately yes:
>>> from graphics import Voxelgrid
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/envs/depth/lib/python3.6/site-packages/graphics/__init__.py", line 185, in <module>
_root = tk.Tk()
File "/opt/conda/envs/depth/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display "gpu-cloud-vnode101.dakao.io:10.0"
This problem never happened to me on a cluster because Voxelgrid is not using anything related to visualization. A quick and dirty workaround would be to copy the Voxelgrid class together with the functions it depends on (sampler.py, transform.py, utils.py) to your project and import it from there. Then, you should not run into this problem anymore.