Forums

Help Regarding NEWSAPI

Hi. I used newsapi for my flask web application. When I am trying to host it, I am getting the following error:

Error running WSGI application

ModuleNotFoundError: No module named 'newsapi'

File "/var/www/avigon_pythonanywhere_com_wsgi.py", line 16, in <module>

from app import app as application # noqa

File "/home/AviGon/mysite/app.py", line 3, in <module>

from newsapi import NewsApiClient

We've got a help page for that. Make sure that you've installed the module for the same Python version / environment that you're running your web app with / in.

My python version in my PC is 3.10. But in the website it is running on python 3.9. There is no option for 3.10 version in this website. What should I do? I do not want to downgrade python in my system. Thank you.

It does not look like the python version problem, just the missing modules, that could mean that you either never installed them or you are running your web app in different environment. See the page my colleague linked to above.

The web app is running perfectly in my localhost. I have seen the page attached. I still am confused. Can you please help me?

Have you installed the newsapi package on PythonAnywhere?

Yes I entered the following command in bash console: pip3 install --user newsapi-python

It was successful. Still I am getting the same error.

Are you sure that you're looking at the current error and not one from before you installed the package? In the error log file, the most recent error will be at the end of the file. Each line has a date and timestamp at the start.

Ok it is working perfectly now! Thank you very much for you help!!

Glad to hear that!