AttributeError: 'AxesSubplot' object has no attribute 'canvas'

I am trying to convert a simple matplotlib figure to plotly. The figure is the automatically select N features plot from pandas. I tried to get the X and Y values directly but it did not work. I also tried to plot the matplotlib figure first and then convert the code using:

fig = feat_importances.nlargest(10).plot(kind='barh')

plotly_fig = tls.mpl_to_plotly(fig)
plotly_fig = go.Figure(plotly_fig)


However then I get the error "AttributeError: ‘AxesSubplot’ object has no attribute ‘canvas’. Any ideas to get it to work?