assert mpl_data_dir, "Failed to determine matplotlib's data directory!" AssertionError: Failed to determine matplotlib's data directory!
1) Go to the folder where pyinstaller is installed.
2) Go to the hooks folder.
3) Locate and open hook-matplotlib.py file.
4) Delete the PyInstaller import and then import matplotlib.
5) change the exec_statement() function to matplotlib.get_data_path() function, you can delete the assert.
If you followed correctly, your code should look like this:
import matplotlib
mpl_data_dir = matplotlib.get_data_path()
datas = [
(mpl_data_dir, "matplotlib/mpl-data"),
]
#Link : https://stackoverflow.com/a/67922414