Forums

gspread

Hi,

I did pip install gspread in my virtual env, but still get this error message:

2020-03-21 10:24:22,724: Error running WSGI application 2020-03-21 10:24:22,724: ModuleNotFoundError: No module named 'gspread'

and then it points to the import line.

Any idea?

Thanks

Make sure that you have installed it into the virtualenv that your web app is using by opening a console in the virtualenv from your web app config page and then doing:

pip show gspread

Hi Glenn, I think pip show tells me its there,:

(my-virtualenv) 10:14 ~ $ pip show gspread Name: gspread Version: 3.3.0 Summary: Google Spreadsheets Python API Home-page: https://github.com/burnash/gspread Author: Anton Burnashev Author-email: fuss.here@gmail.com License: MIT Location: /home/AsaSor/.virtualenvs/my-virtualenv/lib/python3.7/site-packages Requires: requests Required-by: (my-virtualenv) 15:00 ~ $

The required "requests" is also there. Still the error persists

Have you reloaded your web app since installing the module?

Did you solve it? I have the same problem

@Eken Is it in the web app? Do you use a virtual environment? What is your exact error?

Hey. I am having trouble with this too. I followed instructions from https://help.pythonanywhere.com/pages/Flask/ and I have gspread==3.6.0 in my requirements.txt file and used pip install -r requirements.txt.

When I went into bash and did ~/mysite $ pip show gspread, it gave me "Name: gspread Version: 3.6.0 Summary: Google Spreadsheets Python API Home-page: https://github.com/burnash/gspread Author: Anton Burnashev Author-email: fuss.here@gmail.com License: MIT Location: /home/KwikLook/.virtualenvs/my-virtualenv/lib/python3.6/site-packages Requires: google-auth-oauthlib, google-auth, requests"

so I know it's installed but when I refresh the web app and try to load it up i get the below in my error logs: 2020-12-15 08:28:27,399: File "/home/KwikLook/mysite/flask_app.py", line 18, in <module> 2020-12-15 08:28:27,399: ********* 2020-12-15 08:28:27,399: If you're seeing an import error and don't know why, 2020-12-15 08:28:27,399: we have a dedicated help page to help you debug: 2020-12-15 08:28:28,033: Error running WSGI application 2020-12-15 08:28:28,033: ModuleNotFoundError: No module named 'gspread' 2020-12-15 08:28:28,033: File "/var/www/kwiklook_pythonanywhere_com_wsgi.py", line 16, in <module> 2020-12-15 08:28:28,033: from flask_app import app as application # noqa 2020-12-15 08:28:28,033: 2020-12-15 08:28:28,034: File "/home/KwikLook/mysite/flask_app.py", line 18, in <module> 2020-12-15 08:28:28,034: import gspread

Help !

Did you install it in the virtual environment? Is your web app configured to run in the virtual environment? Was your bash with the virtual environment activated?

I have the same issue.

I have only one virtual env: @fjl how can I check if the app is not using it?

Solved looking here https://help.pythonanywhere.com/pages/Virtualenvs/#step-3-configure-your-app-to-use-this-virtualenv

Glad to hear that you made it work!

FWIW - I encountered this problem, and my fix was doing a "python -V" from the bash console - which returned "Python 3.9.5". Then on the Web tab of my app on pythonanywhere.com, I changed the python version to 3.9 (from 3.6).

This worked for me; I'm not honestly not sure why - but I did so because I read a few things about Python version mismatches. Hope this helps someone!

Thanks for posting! Yes, with installed modules you have to take account of the Python version -- each version has its own separate set of installed packages.