princeton-vl / RAFT

BSD 3-Clause "New" or "Revised" License
3.23k stars 629 forks source link

I keep getting this error on colab : cannot connect to X server #135

Closed ilinii closed 2 years ago

ilinii commented 2 years ago

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.

zhaoyingpan commented 2 years ago

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!

ilinii commented 2 years ago

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 !