2

When I'm using AppEngine dev server it fails to import matplotlib although it's installed.

$ python -V
Python 2.7.15
$ pip show matplotlib
Name: matplotlib
Version: 1.2.0

The error I'm getting:

import matplotlib.pyplot as plt
ImportError: No module named matplotlib.pyplot

I went through the doc page here, and it says that "experimental" version is not supported. Which version of matplotlib is considered as experimental? Although I'm using the same version as built-in matplotlib it seems have the same issue. Is it possible to use matplotlib with AppEngine dev server?

Katayoon
  • 592
  • 5
  • 13
gang
  • 21
  • 1
  • The symptoms are identical to https://stackoverflow.com/questions/18176591/importerror-no-module-named-matplotlib-pyplot. – user202729 Oct 17 '18 at 16:36

1 Answers1

0

https://cloud.google.com/appengine/docs/standard/python/tools/built-in-libraries-27

It looks like there is only 1 version of matplotlib available, so I'd guess it won't work on your local dev server in general.

You could set up an additional lib folder called localhost_libs and install it to there, like this pip install -t localhost_libs/ matplotlib

And then put something like this in your appengine_config.py

from google.appengine.ext import vendor

vendor.add('lib')

# If on local dev server
if os.environ.get('SERVER_SOFTWARE', '').startswith('Development'):
    vendor.add('localhost_libs')
Alex
  • 5,141
  • 12
  • 26