I am having trouble importing matplotlib into google app engine. I have googled around and found some solutions but none of them seem to work for me. In my app.yaml file I have
libraries:
- name: matplotlib
version: latest
- name: numpy
version: latest
In my python file I will import numpy I can have
numpy.arange(10)
The problem is when I try to import matplotlib
import matplotlib as plt
I get this error when visiting the page
The website encountered an error while retrieving http://localhost:8080/.
It may be down for maintenance or configured incorrectly.
I remove the matplotlib import, refresh, and everything works again. I have seen app engine webpages use matplotlib such as http://gae-matplotlib-demo.appspot.com that import matplotlib so I know it is possible.
How can I use matplotlib in Google App Engine?
Unfortunately, Matplotlib does not currently work in the GAE Dev Appserver, as explained in Matplotlib notes on the libraries page. It should work if you deploy it to the production server using appcfg. I realise this is not ideal for development, though. We will update that page when the development server supports Matplotlib.
As @mjibson pointed out, Dima Tisnek has worked out a way of getting it working in the dev appserver, but it involves a bit of hacking, and we don't officially support this approach. (For the record, I was able to get it working with this approach.)
Matt Giuca
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With