numpy is supported as a library in google app engine according to the official documentation here. I was not able to import it after a few trials, can anyone share the code to use it?
I believe it should be called in app.yaml with:
libraries:
- name: numpy
version: "1.6.1"
And then be imported in the script somehow. I tried the obvious:
import numpy
but it gave me the following error:
ImportError: No module named numpy
Any simple code is appreciated, for example how do you do the "numpy.average" function in a google app engine script?
>>> data = range(1,5)
>>> data
[1, 2, 3, 4]
>>> np.average(data)
2.5
If you want it to work locally you have to download and install it locally (I got mine from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
Besides that you have to make sure you are running python27, and that you're importing it in the app.yaml file, e.g.:
application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: no
handlers:
- url: /.*
script: helloworld.py
libraries:
- name: numpy
version: "1.6.1"
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