Q:

OverflowError: Python int too large to convert to C ssize_t

I run into this error today, the code is:
import networkx as nx
import matplotlib.pyplot as plt

l = [
    1, 7, 0, 0, 6, 8, 1, 8, 0, 5, 4, 2, 2, 8, 8, 4, 5, 4, 8, 3, 1, 8, 0, 1, 9,
    7, 5, 4, 5, 4, 2, 4, 5, 8, 1, 4, 4, 5, 7, 4, 5, 2, 4, 2, 4, 7, 8, 5, 0
]

plt.figure(15, figsize=(15, 7))
pos = {}

for i in range(0, len(l)):
    pos[i] = (i, l[i])

X = nx.Graph()
X.add_nodes_from(pos.keys())

for i in range(0, len(l) - 1):
    X.add_edge(i, i + 1, weight=1, label='I')

for n1, p in pos.items():
    X.node[n1]['pos'] = p

labeldict = dict(zip(range(0, len(l)), [str(i) for i in l]))
nx.draw_networkx_nodes(X, pos, node_size=200, node_color='orange')
nx.draw_networkx_labels(
    X, pos, labels=labeldict, font_size=14, font_family='sans-serif')
nx.draw_networkx_edges(X, pos, width=1, edge_color='g')
plt.show()

But I never run into this error with similar code befor, could someone tell me how come the error?
The full error is: 
 Exception in Tkinter callback
 Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/matplotlib/backends/tkagg.py", line 22, in blit
     id(data), colormode, id(bbox_array))
 _tkinter.TclError: invalid command name "PyAggImagePhoto"

During handling of the above exception, another exception occurred:
 Traceback (most recent call last):
   File "/usr/lib/python3.5/tkinter/__init__.py", line 1562, in __call__
     return self.func(*args)
   File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 283, in resize
     self.show()
   File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 355, in draw
     tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
   File "/usr/lib/python3/dist-packages/matplotlib/backends/tkagg.py", line 26, in blit
     _tkagg.tkinit(tk.interpaddr(), 1)
 OverflowError: Python int too large to convert to C ssize_t

A:

It seems t the problem come out of TkAgg backend, I try add:
import matplotlib
matplotlib.use('Qt5Agg')

before 
import matplotlib.pyplot as plt

Unexpected all's working fine.

