Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot connect to X server GOOGLE COLAB

I am trying to make a prediction using Tensorflow Object Detection API on Google COLAB. Already I successfully completed the training process and Export Inference Graph task.

But Problem is when I am going to make a new prediction it's throwing some error log.

cannot connect to X server

Now I am unable to make a new prediction. Some portion of my error log:

totalMemory: 11.17GiB freeMemory: 6.65GiB
2019-02-07 15:08:38.398219: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-02-07 15:08:38.745889: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-02-07 15:08:38.745955: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0 
2019-02-07 15:08:38.745975: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N
2019-02-07 15:08:38.746201: W 
tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:42] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.
2019-02-07 15:08:38.746259: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6426 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:04.0, compute capability: 3.7)
2019-02-07 15:08:39.683618: W ./tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node Preprocessor/map/while/ResizeToRange/strided_slice_3. Error: Pack node (Preprocessor/map/while/ResizeToRange/stack_2) axis attribute is out of bounds: 0
2019-02-07 15:08:40.360560: W ./tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node Preprocessor/map/while/ResizeToRange/strided_slice_3. Error: Pack node (Preprocessor/map/while/ResizeToRange/stack_2) axis attribute is out of bounds: 0
2019-02-07 15:08:40.646093: I tensorflow/stream_executor/dso_loader.cc:152] successfully opened CUDA library libcublas.so.10.0 locally
: cannot connect to X server 

How can I figure out the reason for this problem?

like image 790
Md. Razibul Hasan Mithu Avatar asked Feb 07 '19 15:02

Md. Razibul Hasan Mithu


People also ask

Is Google colab not working?

Update your Google Chrome version to >=80 and it works perfectly! Show activity on this post. an internet connection problem: so check your internet connection first, or try opening other sites. the notebook you are trying to open is corrupted: try to open a new notebook from colab.

How do I get Google colab to work?

To execute the code in the above cell, select it with a click and then either press the play button to the left of the code, or use the keyboard shortcut "Command/Ctrl+Enter". To edit the code, just click the cell and start editing.


2 Answers

I had the same problem in Colab for a simple OpenCV program to track a tennis ball in a tennis match video and had to comment out these lines, as mentioned by @anand:

#cv2.namedWindow("motion")
#cv2.imshow("motion", img)# モーション画像を表示 

#cv2.destroyAllWindows()

Note: the above lines were not clustered but spread apart.

like image 114
mLstudent33 Avatar answered Oct 23 '22 22:10

mLstudent33


An X server is a program in the X Window System that runs on local machines (i.e. the computers used directly by users) and handles all access to the graphics cards, display screens and input devices (typically a keyboard and mouse) on those computers.

With that said Colab runs as a terminal instance in the server, if you are using GPU runtime, then the problem is not with X server accessing your Graphics card, neither with Input devices, generally this occurs when you try to parse some data that should be displayed as separate window on your desktop, commands like cv2.imshow(), there can be other similar functions that can cause this problem, if you have to use graphical ouput you might want to look into %matplotlib notebook and displaying the data in the interactable matplot plots.

If this is not your issue, just post a link to your modified code and I might be able to help more.

like image 29
anand_v.singh Avatar answered Oct 23 '22 22:10

anand_v.singh