Matplotlib issue with PyInstaller

Hi all,

I just used PyInstaller for the first time to package a little script that uses a Tkinter interface for user inputs and Matplotlib for plotting some maps.

It was successfully packaged and starts up fine (Tkinter interface in particular works nominally) but once the Matplotlib plot command is called, I get this error in the console:

plotter.py:115: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

I assume it has something to do with my import statements. I’m plotting through xarray, which uses matplotlib. The plot call is pretty vanilla, but included below along with the imports.

Imports:

import xarray as xr
import matplotlib.pyplot as plt
from tkinter import messagebox, ttk, filedialog
import tkinter as tk

Plot:

da.plot(
levels=[-20000, cutoff_depth, 0, 5000],
colors=[“#4c57e0”,“#add8e6”,“#bebebe”],
add_labels=True,
aspect=1.3,
size=8
)

plt.show()