Hi there, I've been trying to solve this issue all day now but haven't been able to do so. I want to host a small Flask based API to serve my machine learning model and access it from outside. When I run my WSGI file in the console, everything seems to work quite well (as it does on my local machine) but when I try to access it through the domain name username.pythonanywhere.com it throws an error.
This is the error log entry:
2023-09-28 10:51:48,308: Error running WSGI application
2023-09-28 10:51:48,319: ImportError: C extension: None not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext' to build the C extensions first.
2023-09-28 10:51:48,319: File "/var/www/phylanx_pythonanywhere_com_wsgi.py", line 16, in <module>
2023-09-28 10:51:48,319: from flask_app import app as application # noqa
2023-09-28 10:51:48,319:
2023-09-28 10:51:48,319: File "/home/phylanx/mysite/flask_app.py", line 3, in <module>
2023-09-28 10:51:48,320: import pandas as pd
2023-09-28 10:51:48,320:
2023-09-28 10:51:48,320: File "/home/phylanx/.local/lib/python3.10/site-packages/pandas/__init__.py", line 28, in <module>
2023-09-28 10:51:48,320: raise ImportError(
2023-09-28 10:51:48,320: ***************************************************
2023-09-28 10:51:48,320: If you're seeing an import error and don't know why,
2023-09-28 10:51:48,320: we have a dedicated help page to help you debug:
2023-09-28 10:51:48,320: https://help.pythonanywhere.com/pages/DebuggingImportError/
I'm out of options here, help would be highly appreciated.
Edit1: This is my requirements.txt
sentence-transformers==2.2.2
scikit-learn==1.2.2
Flask==2.2.2
joblib==1.2.0
pandas==2.1.0
pickleshare==0.7.5
I installed Pytorch manually via torch --extra-index-url https://download.pytorch.org/whl/cpu in order to get the much leaner cpu-only version.