I was using:
- python3
- virtualenv
- matplotlib
To create the virtual environment I used:
virtualenv -p python3 <myproject name>
However, when I used:
python3 -m venv <myproject name>
It worked ok.
An explanation was found here:
https://matplotlib.org/faq/osx_framework.html