Python3.10 runserver TypeError: Parameter to MergeFrom() must be instance of same class: expected google.datastore.v1.Projection got Projection.

52 views
Skip to first unread message

SQF

unread,
Feb 5, 2024, 5:54:52 AM2/5/24
to djangae-users
I have an app on Google App Engine that uses Djangae and Django GCloud Connectors (gcloudc). After upgrading to the Python 3.10 runtime on GAE, the app works well in production, but I can't figure out how to run the local development server.
Following the documentation, I have added gcloudc.commands to the top of INSTALLED_APPS, but running ./manage.py runserver results in the following error:
$ ./manage.py runserver /home/username/backend.worktrees/Python3/app/sitepackages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING) /home/username/backend.worktrees/Python3/app/sitepackages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING) Your current Google Cloud CLI version is: 450.0.0 The latest available version is: 462.0.1 INFO 2024-02-05 08:56:26,932 [_start_emulator:141] Starting Cloud Datastore Emulator INFO 2024-02-05 08:56:26,933 [_start_emulator:142] GCLOUDC_PROJECT_ID: test INFO 2024-02-05 08:56:26,934 [_datastore_filename:91] BASEDIR from __init__: /home/username/backend.worktrees/Python3/app INFO 2024-02-05 08:56:26,935 [_get_args:104] Saving data.... to /home/username/backend.worktrees/Python3/app/.datastore INFO 2024-02-05 08:56:26,935 [_datastore_filename:91] BASEDIR from __init__: /home/username/backend.worktrees/Python3/app INFO 2024-02-05 08:56:26,938 [_wait_for_datastore:114] Waiting for Cloud Datastore Emulator... WARNING: Reusing existing data in [/home/username/backend.worktrees/Python3/app/.datastore]. /home/username/backend.worktrees/Python3/app/sitepackages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING) /home/username/backend.worktrees/Python3/app/sitepackages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING) Watching for file changes with StatReloader INFO 2024-02-05 08:56:33,228 [run_with_reloader:637] Watching for file changes with StatReloader Performing system checks... System check identified some issues: WARNINGS: ?: (caches.W003) Your 'default' cache LOCATION path is relative. Use an absolute path instead. System check identified 1 issue (0 silenced). Exception in thread django-main-thread: Traceback (most recent call last): File "/home/username/.pyenv/versions/3.10.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/home/username/.pyenv/versions/3.10.10/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/home/username/backend.worktrees/Python3/app/sitepackages/django/utils/autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/home/username/backend.worktrees/Python3/app/sitepackages/django/core/management/commands/runserver.py", line 121, in inner_run self.check_migrations() File "/home/username/backend.worktrees/Python3/app/sitepackages/django/core/management/base.py", line 486, in check_migrations executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) File "/home/username/backend.worktrees/Python3/app/sitepackages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/home/username/backend.worktrees/Python3/app/sitepackages/django/db/migrations/loader.py", line 53, in __init__ self.build_graph() File "/home/username/backend.worktrees/Python3/app/sitepackages/django/db/migrations/loader.py", line 220, in build_graph self.applied_migrations = recorder.applied_migrations() File "/home/username/backend.worktrees/Python3/app/sitepackages/django/db/migrations/recorder.py", line 77, in applied_migrations if self.has_table(): File "/home/username/backend.worktrees/Python3/app/sitepackages/django/db/migrations/recorder.py", line 56, in has_table tables = self.connection.introspection.table_names(cursor) File "/home/username/backend.worktrees/Python3/app/sitepackages/django/db/backends/base/introspection.py", line 52, in table_names return get_names(cursor) File "/home/username/backend.worktrees/Python3/app/sitepackages/django/db/backends/base/introspection.py", line 47, in get_names return sorted(ti.name for ti in self.get_table_list(cursor) File "/home/username/backend.worktrees/Python3/app/sitepackages/gcloudc/db/backends/datastore/base.py", line 531, in get_table_list kinds = [entity.key.id_or_name for entity in query.fetch()] File "/home/username/backend.worktrees/Python3/app/sitepackages/gcloudc/db/backends/datastore/base.py", line 531, in <listcomp> kinds = [entity.key.id_or_name for entity in query.fetch()] File "/home/username/backend.worktrees/Python3/app/sitepackages/google/api_core/page_iterator.py", line 208, in _items_iter for page in self._page_iter(increment=False): File "/home/username/backend.worktrees/Python3/app/sitepackages/google/api_core/page_iterator.py", line 244, in _page_iter page = self._next_page() File "/home/username/backend.worktrees/Python3/app/sitepackages/google/cloud/datastore/query.py", line 780, in _next_page query_pb = self._build_protobuf() File "/home/username/backend.worktrees/Python3/app/sitepackages/google/cloud/datastore/query.py", line 720, in _build_protobuf pb = _pb_from_query(self._query) File "/home/username/backend.worktrees/Python3/app/sitepackages/google/cloud/datastore/query.py", line 865, in _pb_from_query pb.projection.append(projection) TypeError: Parameter to MergeFrom() must be instance of same class: expected google.datastore.v1.Projection got Projection.
A quick google search suggests installing a different version of the protobuf library. I tried versions 3.20.3, 3.20.1, 4.25.2 (newest), and even deleted the protobuf directory from sitepackages, but the error message did not change.

Here is some extra info:

app.yaml

runtime: python310 app_engine_apis: true entrypoint: gunicorn myapp.wsgi:application -b :$PORT -w 8 -t 600 instance_class: F4 handlers: - url: /internal/.* script: auto secure: always login: optional - url: /static static_dir: static/ secure: always - url: /.* script: auto secure: always

requirements.txt:

django-cors-headers==4.2.0 djangorestframework==3.14.0 djangorestframework-jwt==1.11.0 line-bot-sdk==3.1.0 requests-toolbelt==0.10.1 qrcode==7.4.2 xmltodict==0.13.0 icecream==2.1.3 google-cloud-logging==3.5.0 google-cloud-storage==2.10.0 google-cloud-secret-manager==2.16.2 more_itertools==9.1.0 chardet==5.1.0 djangae==2.0.0rc2 django-gcloud-connectors==0.4.0 django==3.2.20 django-csp==3.7 django-session-csrf==0.7.1 six==1.16.0 # legacy bundled services for python3 appengine-python-standard==1.1.2 # web server (entrypoint) gunicorn==20.1.0 # temporary fix for build error: AttributeError: cython_sources # similar issue: https://github.com/aws/aws-cli/issues/8036 pyyaml==5.3.1
Does anyone know how to fix this?
Reply all
Reply to author
Forward
0 new messages