Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protobuf version issue #139

Open
s7hoang opened this issue Jul 17, 2022 · 4 comments
Open

protobuf version issue #139

s7hoang opened this issue Jul 17, 2022 · 4 comments

Comments

@s7hoang
Copy link

s7hoang commented Jul 17, 2022

After installing python packages in 'requirements.txt' then running python -m ankisyncd I get this error:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/test/Downloads/anki-sync-server-git/src/anki-sync-server/src/ankisyncd/__main__.py", line 8, in <module>
    import ankisyncd.sync_app
  File "/home/test/Downloads/anki-sync-server-git/src/anki-sync-server/src/ankisyncd/sync_app.py", line 33, in <module>
    from anki.collection import Collection
  File "/home/test/.local/lib/python3.10/site-packages/anki/collection.py", line 10, in <module>
    from anki import (
  File "/home/test/.local/lib/python3.10/site-packages/anki/card_rendering_pb2.py", line 14, in <module>
    from anki import generic_pb2 as anki_dot_generic__pb2
  File "/home/test/.local/lib/python3.10/site-packages/anki/generic_pb2.py", line 28, in <module>
    _EMPTY = _descriptor.Descriptor(
  File "/home/test/.local/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 313, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
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.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Downgrading the protobuf package as directed does fix it but I'm not sure if that's the most appropriate solution or if I'm missing something?

@LuckyTurtleDev
Copy link
Contributor

Any news about this?
Even the protobuf package of debian buster is to new. It is possible to regenerate the code, how the error message tell?

@LuckyTurtleDev
Copy link
Contributor

#151

@VikashKothary
Copy link
Member

I've downgraded the protobuf package as a quick fix for this issue.

However, I assume it will be beneficial to regenerate our protos so that we're compatible with the latest version of the library. That being said, I don't know how to do this?

Can anyone here provide some insight?

@dobefore
Copy link
Contributor

dobefore commented Oct 25, 2022

I guess an update on Anki would bypass the issue?

By "regenerate our protos" it will mean use a protobuf compiler protoc to compile .proto files to python file,this would introduce a lot of complexity.

Edit: Yet this also introduce new problems due to the update.I just now tested,it fails to sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants