paddlepaddle安装问题protobuf package to 3.20.x or lower.
按照官方文档安装paddlepaddle 2.3.0后,进行环境验证时,总是提示如下错误:
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).
这说明我们使用的protobuf库的版本高了,可以卸载已经安装过的protobuf 版本,再安装3.20.x以下的版本,我们可以使用3.19.0版本即可,命令如下:
1、卸载protobuf 已经安装的版本
pip uninstall protobuf
Found existing installation: protobuf 4.21.1
Uninstalling protobuf-4.21.1:
Would remove:
......
Proceed (Y/n)? y
Successfully uninstalled protobuf-4.21.1
2、安装3.19.0版本
pip install protobuf==3.19.0
Installing collected packages: protobuf
Successfully installed protobuf-3.19.0
好了,再进行paddle环境的验证吧:
>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
PaddlePaddle works well on 1 CPU.
W0601 23:27:12.940966 28720 fuse_all_reduce_op_pass.cc:76] Find all_reduce operators: 2. To make the speed faster, some all_reduce ops are fused during training, after fusion, the number of all_reduce ops is 2.
PaddlePaddle works well on 2 CPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)