Rndomcoder
Rndomcoder

Reputation: 158

Using Scikit-learn google app engine

I am trying to deploy a python2.7 application on google app engine. It uses few modules like numpy,flask,pandas and scikit-learn. Though I am able to install and use other modules. Installing scikit-learn in lib folder of project give following error:-

Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler handler, path, err = LoadObject(self._handler) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject obj = __import__(path[0]) File "/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/deploynew.py", line 6, in import sklearn File "/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/lib/sklearn/__init__.py", line 56, in from . import __check_build File "/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/lib/sklearn/__check_build/__init__.py", line 46, in raise_build_error(e) File "/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/lib/sklearn/__check_build/__init__.py", line 41, in raise_build_error %s""" % (e, local_dir, ''.join(dir_content).strip(), msg)) ImportError: dynamic module does not define init function (init_check_build) ___________________________________________________________________________ Contents of /base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/lib/sklearn/__check_build: setup.pyc __init__.py _check_build.so setup.py __init__.pyc ___________________________________________________________________________ It seems that scikit-learn has not been built correctly. If you have installed scikit-learn from source, please do not forget to build the package before using it: run python setup.py install or make in the source directory. If you have used an installer, please check that it is suited for your Python version, your operating system and your platform.

Is their any way of using scikit-learn on google app engine?

Upvotes: 8

Views: 1765

Answers (3)

clickbait
clickbait

Reputation: 2998

The newly-released 2nd Generation Python 3.7 Standard Environment (experimental) can run all modules. It's still in beta, though.

Upvotes: 0

snakecharmerb
snakecharmerb

Reputation: 55630

It looks like sci-kit learn is not supported on App Engine's Standard environment for Python 2.x, and the using managed VMs is the preferred solution in this case. See the resolution of this bug.

Also see this similar question for another alternative approach.

Upvotes: 2

syltruong
syltruong

Reputation: 2723

Scikit-learn can now be used on App Engine Flexible Environment.

sklearn just needs to be specified as a dependency in the requirements.txt file.

See this repo for a code sample on how to serve a sklearn model on App Engine.

Upvotes: 3

Related Questions