[GH-ISSUE #130] [REQUEST] Regenerate proto code to support protobuf 4 #16

Open
opened 2026-02-27 08:11:27 +03:00 by kerem · 5 comments
Owner

Originally created by @wolkenschieber on GitHub (May 28, 2022).
Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/130

When using librespot-python in version 0.0.1 it pulls a dependency to package `protobuf´. If this dependency is updated to current version 4.20.1, the library ceases to work producing following error:

  File "/mnt/Development/python/virtualenv/librespot-demo/lib/python3.10/site-packages/librespot/proto/Metadata_pb2.py", line 30, in <module>
    _descriptor.EnumValueDescriptor(
  File "/mnt/Development/python/virtualenv/librespot-demo/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 755, 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).
Originally created by @wolkenschieber on GitHub (May 28, 2022). Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/130 When using `librespot-python` in version 0.0.1 it pulls a dependency to package `protobuf´. If this dependency is updated to current version 4.20.1, the library ceases to work producing following error: ``` File "/mnt/Development/python/virtualenv/librespot-demo/lib/python3.10/site-packages/librespot/proto/Metadata_pb2.py", line 30, in <module> _descriptor.EnumValueDescriptor( File "/mnt/Development/python/virtualenv/librespot-demo/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 755, 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). ```
Author
Owner

@kokarare1212 commented on GitHub (May 29, 2022):

Temporarily forced to use requirements.txt version because proto2 is used in upstream repositories.

<!-- gh-comment-id:1140357568 --> @kokarare1212 commented on GitHub (May 29, 2022): Temporarily forced to use requirements.txt version because proto2 is used in upstream repositories.
Author
Owner

@van4oza commented on GitHub (May 10, 2023):

Can protobuf be updated or changed? having conflicts with google api

    google-api-core 2.11.0 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    librespot 0.0.8 depends on protobuf==3.20.1
    google-api-core 2.10.2 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    librespot 0.0.8 depends on protobuf==3.20.1
    google-api-core 1.34.0 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <4.0.0dev and >=3.19.5
    librespot 0.0.8 depends on protobuf==3.20.1
    google-api-core 1.33.2 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <4.0.0dev and >=3.19.5
<!-- gh-comment-id:1542114980 --> @van4oza commented on GitHub (May 10, 2023): Can protobuf be updated or changed? having conflicts with google api ``` librespot 0.0.8 depends on protobuf==3.20.1 google-api-core 2.11.0 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5 librespot 0.0.8 depends on protobuf==3.20.1 google-api-core 2.10.2 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5 librespot 0.0.8 depends on protobuf==3.20.1 google-api-core 1.34.0 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <4.0.0dev and >=3.19.5 librespot 0.0.8 depends on protobuf==3.20.1 google-api-core 1.33.2 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <4.0.0dev and >=3.19.5 ```
Author
Owner

@kokarare1212 commented on GitHub (May 10, 2023):

It's difficult because proto2 is no longer supported in newer versions at the moment...

<!-- gh-comment-id:1542257450 --> @kokarare1212 commented on GitHub (May 10, 2023): It's difficult because proto2 is no longer supported in newer versions at the moment...
Author
Owner

@ChanceHarrison commented on GitHub (Oct 27, 2024):

Please excuse my lack of understanding, but it isn't clear to me what the path to resolution here might be.

Questions that arise from past past comments:

  • "proto2 is used in upstream repositories"
    • is that still the case? which dependencies/repositories? are they likely to get upgraded or do we have alternatives that are compatible with a newer version of protobuf?
  • "proto2 is no longer supported in newer versions "
    • the newer versions of what?
  • "Temporarily forced to use requirements.txt version"
    • as opposed to what other version?

I would definitely be curious as to if there are any workarounds for package maintainers such that other packages that depend on librespot-python don't run into the same error?

<!-- gh-comment-id:2439864390 --> @ChanceHarrison commented on GitHub (Oct 27, 2024): Please excuse my lack of understanding, but it isn't clear to me what the path to resolution here might be. Questions that arise from past past comments: - "proto2 is used in upstream repositories" - is that still the case? which dependencies/repositories? are they likely to get upgraded or do we have alternatives that are compatible with a newer version of protobuf? - "proto2 is no longer supported in newer versions " - the newer versions of what? - "Temporarily forced to use requirements.txt version" - as opposed to what other version? I would definitely be curious as to if there are any workarounds for package maintainers such that other packages that depend on `librespot-python` don't run into the same error?
Author
Owner

@kokarare1212 commented on GitHub (Oct 27, 2024):

This project is a port of librespot-java for Python.
The original repository now seems to have a mix of proto2 and proto3, but protobuf in Python cannot use proto2 above version 4.0, so versions 3.20.3 or lower must be used.

<!-- gh-comment-id:2439872998 --> @kokarare1212 commented on GitHub (Oct 27, 2024): This project is a port of [librespot-java](https://github.com/librespot-org/librespot-java) for Python. The original repository now seems to have a mix of proto2 and proto3, but protobuf in Python cannot use proto2 above version 4.0, so versions 3.20.3 or lower must be used.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot-python-kokarare1212#16
No description provided.