Forums

Server Error in <my_username>_pythonanywhere_com_wsgi.py

Hello dear I know that it is a known error but i don't understand how can i solve it because the flask library is installed and, based on this output, firebase library is installed too. What can i do to understand what is my problem or what i'm wronging?

2022-07-21 16:13:11,161: Error running WSGI application
2022-07-21 16:13:11,173: TypeError: Descriptors cannot not be created directly.
2022-07-21 16:13:11,173: If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
2022-07-21 16:13:11,174: If you cannot immediately regenerate your protos, some other possible workarounds are:
2022-07-21 16:13:11,174:  1. Downgrade the protobuf package to 3.20.x or lower.
2022-07-21 16:13:11,174:  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
2022-07-21 16:13:11,175: 
2022-07-21 16:13:11,175: More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
2022-07-21 16:13:11,175:   File "/var/www/<my_username>_pythonanywhere_com_wsgi.py", line 16, in <module>
2022-07-21 16:13:11,175:     from flask_app import app as application  # noqa
2022-07-21 16:13:11,175: 
2022-07-21 16:13:11,175:   File "/home/<my_username>/mysite/flask_app.py", line 8, in <module>
2022-07-21 16:13:11,176:     from firebase_admin import firestore
2022-07-21 16:13:11,176: 
2022-07-21 16:13:11,176:   File "/home/<my_username>/.local/lib/python3.9/site-packages/firebase_admin/firestore.py", line 22, in <module>
2022-07-21 16:13:11,176:     from google.cloud import firestore # pylint: disable=import-error,no-name-in-module
2022-07-21 16:13:11,176: 
2022-07-21 16:13:11,176:   File "/home/<my_username>/.local/lib/python3.9/site-packages/google/cloud/firestore.py", line 18, in <module>
2022-07-21 16:13:11,177:     from google.cloud.firestore_v1 import __version__
2022-07-21 16:13:11,177: 
2022-07-21 16:13:11,177:   File "/home/<my_username>/.local/lib/python3.9/site-packages/google/cloud/firestore_v1/__init__.py", line 29, in <module>
2022-07-21 16:13:11,177:     from google.cloud.firestore_v1 import types
2022-07-21 16:13:11,177: 
2022-07-21 16:13:11,177:   File "/home/<my_username>/.local/lib/python3.9/site-packages/google/cloud/firestore_v1/types/__init__.py", line 21, in <module>
2022-07-21 16:13:11,178:     from .document import (
2022-07-21 16:13:11,179: 
2022-07-21 16:13:11,179:   File "/home/<my_username>/.local/lib/python3.9/site-packages/google/cloud/firestore_v1/types/document.py", line 20, in <module>
2022-07-21 16:13:11,179:     from google.type import latlng_pb2  # type: ignore
2022-07-21 16:13:11,180: 
2022-07-21 16:13:11,180:   File "/usr/local/lib/python3.9/site-packages/google/type/latlng_pb2.py", line 46, in <module>
2022-07-21 16:13:11,180:     _descriptor.FieldDescriptor(
2022-07-21 16:13:11,180: 
2022-07-21 16:13:11,180:   File "/home/<my_username>/.local/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 560, in __new__
2022-07-21 16:13:11,180:     _message.Message._CheckCalledFromGeneratedFile()
2022-07-21 16:13:11,181: ***************************************************
2022-07-21 16:13:11,181: If you're seeing an import error and don't know why,
2022-07-21 16:13:11,181: we have a dedicated help page to help you debug: 
2022-07-21 16:13:11,181: https://help.pythonanywhere.com/pages/DebuggingImportError/
2022-07-21 16:13:11,181: ***************************************************

What version of the protobuf library do you have installed? The error message seems to be about that specifically.

I don't know if this protobuf is a sub library of something else lib that i use, but i never called it on my python webapp.

However i have this output on pip -V protobuf

pip 21.1.2 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

however i'm going to upgrade all my lib pip

You should rather use pip show protobuf to get the version of that specific package.

Name: protobuf

Version: 4.21.2

Summary: None

Home-page: https://developers.google.com/protocol-buffers/

Author: protobuf@googlegroups.com

Author-email: protobuf@googlegroups.com

License: 3-Clause BSD License

Location: /home/telegramitalia/.local/lib/python3.9/site-packages

Requires:

Required-by: proto-plus, mysql-connector-python, googleapis-common-protos, google-api-core

However on my pc i have protobuf version 3.20.1 so i tried to downgrade it to this versione given that on my computer the webapp works but, now i have this server/machine error:

ERROR: Could not install packages due to an OSError: [Errno 122] Disk quota exceeded

That just means that your account does not have enough disk space left to install the module.

But I simply updated some libraries that already existed and gave me an error ...

The installation process can take more space than the module takes when it's already installed. You may be able to clear down some space: https://help.pythonanywhere.com/pages/DiskQuota/

du -hs /tmp ~/.[!.] ~/ | sort -h

4.0K    /home/telegramitalia/.bashrc
4.0K    /home/telegramitalia/.gitconfig
4.0K    /home/telegramitalia/.profile
4.0K    /home/telegramitalia/.python_history
4.0K    /home/telegramitalia/.pythonstartup.py
4.0K    /home/telegramitalia/.wget-hsts
4.0K    /home/telegramitalia/README.txt
4.0K    /tmp
8.0K    /home/telegramitalia/.vimrc
52K     /home/telegramitalia/.virtualenvs
6.7M    /home/telegramitalia/mysite
127M    /home/telegramitalia/.cache
378M    /home/telegramitalia/.local

rm -rf /tmp/ /tmp/.

rm: refusing to remove '.' or '..' directory: skipping '/tmp/.'
rm: refusing to remove '.' or '..' directory: skipping '/tmp/..'

So what can i do? I can't just remove .local directory... I think it is absurd that for a week I have been trying to upload a site to pythonanywhere and I am only having problems due to the server

You should add asterisks in the command, like that: rm -rf /tmp/* /tmp/.*, otherwise you're telling Bash to remove the directory itself or its parent, which is not allowed for users. You should be able to remove ~/.local though.

ok i can remove the local folder, but what does it mean? what do i lose by removing this folder?

It will essentially uninstall any modules that you have installed with pip using the --user argument.

i didn't installed nothing, i only upgraded the pip libs...

You can always check what are the contents of ~/.local before wiping it out.

I removed a lot things solving the memory problem, then i have restarted the webapp and i have re-installed the pip lib "google-cloud-firestore". Then i have restarder the webapp and i have "Something went wrong" again with the following phrase error in error.log "ImportError: Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module."

Make sure you installed the missing module for the same Python version / environment that runs your web app.

if can i have python 3.9 on web app i don't have problem with my local versions

I see you already have Python 3.9 set for your web.

and so what is the problem that not permit me to publish my web app?

Can we take a look at your files? We can see them from our admin interface, but we need your permission first.