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.

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
青葱年少的头像青葱年少普通用户
上一篇 2023年2月26日 上午11:20
下一篇 2023年2月26日 上午11:21

相关推荐