PyInstaller with Matplotlib "NameError: name 'defaultParams' is not defined"

07 Oct 2020

Problem

NameError: name 'defaultParams' is not defined is an error which occurs when trying to create an executable with PyInstaller 3.x using code that uses matplotlib and the Matplotlib 3.3.x package.

Solution

Until this issue is fixed the current solution is to pin matplotlib to 3.2.2

Change the matplotlib version in requirements.txt or other dependency configuration to:

matplotlib==3.2.2

And then use pip to install this version into your virtual environment:

pip install --upgrade -r requirements.txt