kokarare1212 / librespot-python

Open Source Spotify Client
http://librespot-python.rtfd.io
Apache License 2.0
241 stars 46 forks source link

[REQUEST] Regenerate proto code to support protobuf 4 #130

Open wolkenschieber opened 2 years ago

wolkenschieber commented 2 years ago

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).
kokarare1212 commented 2 years ago

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

van4oza commented 1 year ago

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
kokarare1212 commented 1 year ago

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

ChanceHarrison commented 1 month ago

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:

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?

kokarare1212 commented 1 month ago

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.