I keep getting this error on colab : cannot connect to X server
ilinii opened this issue · 2 comments
As title says, I've been struggling to find a solution for quite some time now but in vain, this is the full error message: /usr/local/lib/python3.7/dist-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2228.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
: cannot connect to X server
Thanks in advance.
I ran into the same problem. Are you trying to run demo.py? That's because Colab doesn't support cv2.imshow, instead, you will need to use cv2_imshow, and from google.colab.patches import cv2_imshow
. But even without this error, Colab didn't show me images. So I directly write the images with cv2.imwrite to check the results. Hope this helps!
Thank you @zhaoyingpan, I figured how to solve the issue a couple of days ago. That, indeed is the correct answer, or you can save the image instead of showing it, that also works.
For anyone looking for the explanation of the error : Since colab runs a terminal instance in the server, this occurs when you try to parse some data that should be displayed as separate window on your desktop.
Good luck to anyone working on this !