Paddlepaddle installation problem protobuf package to 3.20.x or lower.

After installing paddlepaddle 2.3.0 according to the official documentation, when performing environment verification, the following error is always prompted:

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).

This shows that the version of the protobuf library we use is higher. You can uninstall the installed protobuf version, and then install the version below 3.20.x. We can use the version 3.19.0. The command is as follows:

1. Uninstall the installed version of 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. Install version 3.19.0

pip install protobuf==3.19.0

Installing collected packages: protobuf
Successfully installed protobuf-3.19.0

Ok, let’s verify the paddle environment again:

>>> 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.

Guess you like

Origin blog.csdn.net/songchaofly/article/details/125092409