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 generated file outdated #214

Closed
PiRK opened this issue May 31, 2022 · 1 comment
Closed

protobuf generated file outdated #214

PiRK opened this issue May 31, 2022 · 1 comment

Comments

@PiRK
Copy link
Collaborator

PiRK commented May 31, 2022

Protobuf seems to have made a backwards incompatible change in version 3.21 (released on May 26th 2022)

Traceback (most recent call last):
  File "/usr/local/bin/coverage", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/coverage/cmdline.py", line 943, in main
    status = CoverageScript().command_line(argv)
  File "/usr/local/lib/python3.10/site-packages/coverage/cmdline.py", line 659, in command_line
    return self.do_run(options, args)
  File "/usr/local/lib/python3.10/site-packages/coverage/cmdline.py", line 830, in do_run
    runner.run()
  File "/usr/local/lib/python3.10/site-packages/coverage/execfile.py", line 160, in run
    self._prepare2()
  File "/usr/local/lib/python3.10/site-packages/coverage/execfile.py", line 124, in _prepare2
    pathname, self.package, self.spec = find_module(self.modulename)
  File "/usr/local/lib/python3.10/site-packages/coverage/execfile.py", line 43, in find_module
    spec = importlib.util.find_spec(modulename)
  File "/usr/local/lib/python3.10/importlib/util.py", line 94, in find_spec
    parent = __import__(parent_name, fromlist=['__path__'])
  File "/tmp/cirrus-ci-build/electroncash/__init__.py", line 5, in <module>
    from .wallet import Synchronizer, Wallet
  File "/tmp/cirrus-ci-build/electroncash/wallet.py", line 85, in <module>
    from . import paymentrequest
  File "/tmp/cirrus-ci-build/electroncash/paymentrequest.py", line 40, in <module>
    from . import paymentrequest_pb2 as pb2
  File "/tmp/cirrus-ci-build/electroncash/paymentrequest_pb2.py", line 35, in <module>
    _descriptor.FieldDescriptor(
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 560, 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
@PiRK
Copy link
Collaborator Author

PiRK commented May 31, 2022

@PiRK PiRK mentioned this issue May 31, 2022
PiRK added a commit that referenced this issue May 31, 2022
There are backwards incompatible changes in the latest release of protobuf. See #214 and https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

This is a temporary fix by setting an upper limit to protobuf library.

The proper fix would be to regenerate the _pb2.py files, however it is unclear at the moment if this would keep working on systems with `protobuf<4.21`. For reference, ubuntu 22.04 currently has protobuf version 3.12.4.
PiRK added a commit to PiRK/ElectrumABC that referenced this issue May 11, 2023
See spesmilo#7922 for a good description of the problem and the rational for restricting to this range of `protobuf` versions.
tldr; keepkey support restricts us to `protobuf<4` because we need to support both the new and the old format.

This fixes  Bitcoin-ABC#214

This removes a lot of DeprecationWarning messages due to outdated pb2 files.
@PiRK PiRK closed this as completed in db2a324 May 11, 2023
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

1 participant