Forums

Import error on package I installed

A package I installed into my virtual environment (webargs) gives a "module not found" ImportError even though it is installed.

After making a virtualenv following the guide, I installed flask, flask-restful and webargs, which my app uses. I installed all three the same way through the bash with pip install but only webargs is failing. I even tried to install it again by manually going to the Web tab and then "open bash in this virtualenv" but it understandably told me "requirement already met".

Edit: note that if I enter a console inside the virtualenv (directly from the link in the Web tab) and run $python from there, importing webargs works.

Edit 2: I managed to fix it by fiddling with the path added to sys.path somehow. Consider this resolved.

Cool. Glad you worked it out.

2021-07-16 20:50:29,526: Error running WSGI application 2021-07-16 20:50:29,529: ModuleNotFoundError: No module named 'flask_uploads' 2021-07-16 20:50:29,529: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:50:29,529: from snake import app as application # noqa 2021-07-16 20:50:29,529: 2021-07-16 20:50:29,529: File "/home/infinitygroupx/mysite/snake.py", line 2, in <module> 2021-07-16 20:50:29,529: from flask_uploads import UploadSet, configure_uploads, IMAGES, DOCUMENTS 2021-07-16 20:50:29,529: ******* 2021-07-16 20:50:29,530: If you're seeing an import error and don't know why, 2021-07-16 20:50:29,530: we have a dedicated help page to help you debug: 2021-07-16 20:50:29,530: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:50:29,530: ******* 2021-07-16 20:50:34,837: Error running WSGI application 2021-07-16 20:50:34,838: ModuleNotFoundError: No module named 'flask_uploads' 2021-07-16 20:50:34,838: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:50:34,838: from snake import app as application # noqa 2021-07-16 20:50:34,838: 2021-07-16 20:50:34,838: File "/home/infinitygroupx/mysite/snake.py", line 2, in <module> 2021-07-16 20:50:34,838: from flask_uploads import UploadSet, configure_uploads, IMAGES, DOCUMENTS 2021-07-16 20:50:34,838: ******* 2021-07-16 20:50:34,838: If you're seeing an import error and don't know why, 2021-07-16 20:50:34,838: we have a dedicated help page to help you debug: 2021-07-16 20:50:34,839: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:50:34,839: ******* 2021-07-16 20:50:36,434: Error running WSGI application 2021-07-16 20:50:36,435: ModuleNotFoundError: No module named 'flask_uploads' 2021-07-16 20:50:36,436: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:50:36,436: from snake import app as application # noqa 2021-07-16 20:50:36,436: 2021-07-16 20:50:36,436: File "/home/infinitygroupx/mysite/snake.py", line 2, in <module> 2021-07-16 20:50:36,436: from flask_uploads import UploadSet, configure_uploads, IMAGES, DOCUMENTS 2021-07-16 20:50:36,436: ******* 2021-07-16 20:50:36,436: If you're seeing an import error and don't know why, 2021-07-16 20:50:36,436: we have a dedicated help page to help you debug: 2021-07-16 20:50:36,436: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:50:36,436: ******* 2021-07-16 20:52:20,681: Error running WSGI application 2021-07-16 20:52:20,683: ModuleNotFoundError: No module named 'flask_uploads' 2021-07-16 20:52:20,683: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:52:20,683: from snake import app as application # noqa 2021-07-16 20:52:20,683: 2021-07-16 20:52:20,683: File "/home/infinitygroupx/mysite/snake.py", line 2, in <module> 2021-07-16 20:52:20,683: from flask_uploads import UploadSet, configure_uploads, IMAGES, DOCUMENTS 2021-07-16 20:52:20,683: ******* 2021-07-16 20:52:20,683: If you're seeing an import error and don't know why, 2021-07-16 20:52:20,684: we have a dedicated help page to help you debug: 2021-07-16 20:52:20,684: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:52:20,684: ******* 2021-07-16 20:54:38,984: Error running WSGI application 2021-07-16 20:54:38,988: ModuleNotFoundError: No module named 'flask_mail' 2021-07-16 20:54:38,988: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:54:38,988: from snake import app as application # noqa 2021-07-16 20:54:38,988: 2021-07-16 20:54:38,988: File "/home/infinitygroupx/mysite/snake.py", line 3, in <module> 2021-07-16 20:54:38,988: from flask_mail import Mail, Message 2021-07-16 20:54:38,988: ******* 2021-07-16 20:54:38,989: If you're seeing an import error and don't know why, 2021-07-16 20:54:38,989: we have a dedicated help page to help you debug: 2021-07-16 20:54:38,989: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:54:38,989: ******* 2021-07-16 20:54:43,014: Error running WSGI application 2021-07-16 20:54:43,014: ModuleNotFoundError: No module named 'flask_mail' 2021-07-16 20:54:43,015: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:54:43,015: from snake import app as application # noqa 2021-07-16 20:54:43,015: 2021-07-16 20:54:43,015: File "/home/infinitygroupx/mysite/snake.py", line 3, in <module> 2021-07-16 20:54:43,015: from flask_mail import Mail, Message 2021-07-16 20:54:43,015: ******* 2021-07-16 20:54:43,015: If you're seeing an import error and don't know why, 2021-07-16 20:54:43,015: we have a dedicated help page to help you debug: 2021-07-16 20:54:43,015: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:54:43,015: ******* 2021-07-16 20:54:44,504: Error running WSGI application 2021-07-16 20:54:44,504: ModuleNotFoundError: No module named 'flask_mail' 2021-07-16 20:54:44,504: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:54:44,504: from snake import app as application # noqa 2021-07-16 20:54:44,505: 2021-07-16 20:54:44,505: File "/home/infinitygroupx/mysite/snake.py", line 3, in <module> 2021-07-16 20:54:44,505: from flask_mail import Mail, Message 2021-07-16 20:54:44,505: ******* 2021-07-16 20:54:44,505: If you're seeing an import error and don't know why, 2021-07-16 20:54:44,505: we have a dedicated help page to help you debug: 2021-07-16 20:54:44,505: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:54:44,505: ******* 2021-07-16 20:57:35,024: Error running WSGI application 2021-07-16 20:57:35,024: ModuleNotFoundError: No module named 'flask_excel' 2021-07-16 20:57:35,024: File "/var/www/infinitygroupx_pythonanywhere_com_wsgi.py", line 16, in <module> 2021-07-16 20:57:35,024: from snake import app as application # noqa 2021-07-16 20:57:35,024: 2021-07-16 20:57:35,024: File "/home/infinitygroupx/mysite/snake.py", line 8, in <module> 2021-07-16 20:57:35,024: import flask_excel as excel,jsonify,io 2021-07-16 20:57:35,025: ******* 2021-07-16 20:57:35,025: If you're seeing an import error and don't know why, 2021-07-16 20:57:35,025: we have a dedicated help page to help you debug: 2021-07-16 20:57:35,025: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-07-16 20:57:35,025: *******

You need to install the package that provides the "flask_uploads" module.

what is the package please? I have been trying to get through this error since morning but haven't resolve it till now

Probably this one: https://pypi.org/project/Flask-Uploads/

It has already been installed, but I tried again to confirm and I got the message below <br><br> $ pip install Flask-Uploads Defaulting to user installation because normal site-packages is not writeable Looking in links: /usr/share/pip-wheels Requirement already satisfied: Flask-Uploads in /home/commerce/.local/lib/python3.10/site-packages (0.2.1) Requirement already satisfied: Flask>=0.8.0 in /home/commerce/.local/lib/python3.10/site-packages (from Flask-Uploads) (2.2.2) <br><br> The message below is from server error <br><br> Error running WSGI application 2023-05-04 08:58:01,488: ModuleNotFoundError: No module named 'flask_uploads' 2023-05-04 08:58:01,488: File "/var/www/commerce_pythonanywhere_com_wsgi.py", line 16, in <module> 2023-05-04 08:58:01,488: from main import app as application # noqa 2023-05-04 08:58:01,489: 2023-05-04 08:58:01,490: File "/home/commerce/FlaskEcommerce/main.py", line 5, in <module> 2023-05-04 08:58:01,490: from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class