[(Basically identical to this from a few months ago: https://stackoverflow.com/questions/41319082/import-matplotlib-failing-with-no-module-named-tkinter-on-heroku . However, the only solution provided doesn't seem to work. (Unfortunately I can't comment on the answer given there since I don't have enough StackOverflow reputation.))]
I've been plotting using matplotlib in my app. Everything works fine locally. However when I push my app to Heroku I get the error:
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
I've tried to circumvent Tkinter by doing:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt, mpld3
However this still throws the same error.
Has anyone found a solution for this or have a Heroku app with matplotlib that is working? I'm running Python 2.7.13 (that's also the version Heroku installs when pushing the app).
[Addition as autobot claims this is a duplicate question which it is not: Note that this question is specifically related to using matplotlib on Heroku. Therefore, any other question unrelated to Heroku does not help in answering this question]