MAVSDK-Python icon indicating copy to clipboard operation
MAVSDK-Python copied to clipboard

Protobuf Warning (UserWarning: Protobuf gencode version 5.29.0)

Open afwilkin opened this issue 6 months ago • 6 comments

Video Describing Warning

It SEEMS like protobuf python version was just upgraded and the .proto files seem to be mismatched by a major version

/home/atlas/iperf_testing/test_dep/env/lib/python3.10/site-packages/google/protobuf/runtime_version.py:98: UserWarning: Protobuf gencode version 5.29.0 is exactly one major version older than the runtime version 6.31.1 at mission/mission.proto. Please update the gencode to avoid compatibility violations in the next runtime release.
  warnings.warn(
/home/atlas/iperf_testing/test_dep/env/lib/python3.10/site-packages/google/protobuf/runtime_version.py:98: UserWarning: Protobuf gencode version 5.29.0 is exactly one major version older than the runtime version 6.31.1 at mission_raw/mission_raw.proto. Please update the gencode to avoid compatibility violations in the next runtime release.
  warnings.warn(
/home/atlas/iperf_testing/test_dep/env/lib/python3.10/site-packages/google/protobuf/runtime_version.py:98: UserWarning: Protobuf gencode version 5.29.0 is exactly one major version older than the runtime version 6.31.1 at mission_raw_server/mission_raw_server.proto. Please update the gencode to avoid compatibility violations in the next runtime release.

To recreate:

  • pip3 install mavsdk
  • -try to run example here: https://github.com/mavlink/MAVSDK-Python/tree/main/examples

afwilkin avatar Jun 03 '25 22:06 afwilkin

This could also be a me thing that I am not seeing, but thought i would at least mention it

afwilkin avatar Jun 03 '25 22:06 afwilkin

Thanks. I haven't seen this myself. Have you tried to update the protobuf dependency?

It looks like we should probably bump the version here: https://github.com/mavlink/MAVSDK-Python/blob/483ed92234f91f647fa319ad7ccbbec02ca45a80/requirements.txt#L1

julianoes avatar Jun 05 '25 00:06 julianoes

@julianoes I havent manually updated it. but, when i start a new project and pip3 install mavsdk it seems to install the latest protobuf

Image

I would say that if you are in a new environment with a virtual environment...probably a me problem.

I am on ubuntu 22.

afwilkin avatar Jun 11 '25 20:06 afwilkin

Isn't this a problem with the included gencode files being incompatible with current version of protobuf v6.31.1? I am also getting these warnings. I worked around this by manually specifying a version of protbuf matching the specifier protobuf~=5.29 is installed in my environment.

Your requirements.txt requires greater-than or equal to protobuf 5.27.1, however, the generated *_pb2.py files included in the python wheel for mavsdk 3.5.0` where created with protobuf version v5.29.0.

Image

If mavsdk is used with protobuf 5.27.1, I get this error:

google.protobuf.runtime_version.VersionError: Detected incompatible Protobuf Gencode/Runtime versions when loading action/action.proto: gencode 5.29.0 runtime 5.27.1. Runtime version cannot be older than the linked gencode version. See Protobuf version guarantees at https://protobuf.dev/support/cross-version-runtime-guarantee.

I suggest that the requirements use the ~= specifier, and bump the version to 5.29. As it is right now, dependency resolution for mavsdk is kinda broken...

jack-mil avatar Jun 12 '25 18:06 jack-mil

@jack-mil feel free to make a pull request to fix it. You seem to have a better handle on it than me. I haven't had time to look into it yet.

julianoes avatar Jun 12 '25 22:06 julianoes

Sorry, I am not familiar enough with this package, protobuf, or your build system in general to be able to make changes like that. I am not a regular user of mavsdk. But some sort of dependency lock file (uv.lock, frozen pip requirements, pylock.toml) for your Actions build workflow would help with pulling in unexpected dependency versions as build time.

jack-mil avatar Jun 16 '25 17:06 jack-mil