why importing tensorflow_models interrupt matplotlib in colab?

32 views Asked by At

Running

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()

plots the plot with no problem, but

import tensorflow_models
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()

doesn't plot anythig. I use colab notebook. Why is this happan?

1

There are 1 answers

0
Hamid On

if you don't install the requires packages, first you have to install the package for imported modules by code below

!pip install tf-models-official

and next you must add a line for matplotlib in colab, see below

%matplotlib inline # line to add!
import tensorflow_models
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()