0
votes

I'm trying to deploy my flask app on Pythonanywhere but am getting an error i have no idea what to do about. I've looked online and people haven't been getting similar errors like mine.

My app loads a bunch of pretrained ML models. Would love some help!

2018-10-16 20:52:38 /home/drdesai/.virtualenvs/flask-app-env/lib/python3.6/site-packages/sklearn/base.py:251: UserWarning: Trying to unpickle estimator LinearRegression from version 0.19.1 when using version 0.20.0. This might lead to breaking code or invalid results. Use at your own risk.#012 UserWarning)

2018-10-16 20:52:38 !!! uWSGI process 1 got Segmentation Fault !!!

2018-10-16 20:52:38 * backtrace of 1 *#012/usr/local/bin/uwsgi(uwsgi_backtrace+0x2c) [0x46529c]#012/usr/local/bin/uwsgi(uwsgi_segfault+0x21) [0x465661]#012/lib/x86_64-linux-gnu/libc.so.6(+0x36cb0) [0x7f6ed211ccb0]#012/home/drdesai/.virtualenvs/flask-app-env/lib/python3.6/site-packages/sklearn/neighbors/kd_tree.cpython-36m-x86_64-linux-gnu.so(+0x404b6) [0x7f6ead1d54b6]#012/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyCFunction_FastCallDict+0x105) [0x7f6ed0e80005]#012/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x16b5fa) [0x7f6ed0f195fa]#012/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x2f3c) [0x7f6ed0f1ccfc]#012/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x16a890) [0x7f6ed0f18890]#012/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x16b7b4) [0x7f6ed0f197b4]#012/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x2f3c) [0x7f6ed0f1ccfc]#012/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x16a890) [0x7f6ed0f18890]#012/usr/lib/x86_

2018-10-16 20:52:38 chdir(): No such file or directory [core/uwsgi.c line 1610]

2018-10-16 20:52:38 VACUUM: unix socket /var/sockets/drdesai.pythonanywhere.com/socket removed.

2

2 Answers

1
votes

Are you using Tensorflow? It does some strange stuff with threads, which can make it crash in PythonAnywhere websites (which don't allow threading). If you're using Keras with the Tensorflow backend, you should be able to get it to work by using Theano instead -- more information on this help page.

0
votes

uWSGI is a C/C++ compiled app and segmentation fault is its internal error that means that there is some incorrect behavior in uWSGI logic: somewhere in its code it's trying to get access to area of memory it's not allowed to access to, so OS kills this process and returns "segfault" error. So make sure you have the latest stable version of uwsgi installed. Also make sure you installed it properly either using a package manager or via manual compiling. It's recommended to install it using a package manager since it's much more easy than via manual compiling. Also, make sure you use it properly.