- 解决报错:TypeError: Descriptors cannot 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).
- 你遇到的是 protobuf 版本不兼容导致的典型错误,wandb 依赖的 databus 的 _pb2.py 文件是旧版本 protoc 生成的,但你当前安装的 protobuf 是 4.x 或更高版本
- 直接把 protobuf 降级到 3.20.x(注意:使用 3.20.x 是 Google 官方推荐的兼容模式,几乎所有旧包都能正常运作)
pip install protobuf==3.20.3