Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于安装paddle 发行版本遇到protobuf 的报错问题 #43052

Closed
dingjiaweiww opened this issue May 27, 2022 · 6 comments
Closed

关于安装paddle 发行版本遇到protobuf 的报错问题 #43052

dingjiaweiww opened this issue May 27, 2022 · 6 comments

Comments

@dingjiaweiww
Copy link
Contributor

dingjiaweiww commented May 27, 2022

问题描述 Please describe your issue

问题原因:
protobuf 于 2022.05.26 发布了 4.21 版本,如果您环境中没有 protobuf 的话,默认安装 paddle 时会自动下载最高版本的protobuf 4.21,paddle能安装成功但是 import paddle 会报错,这是由于protobuf 4.21 为不兼容升级,目前 develop 版本的 paddle 已经修复了这个问题( see #43009 ),但是发行版由于已经编包发布所以仍存在这个问题,飞桨会在下个版本2.3.1中解决。
参考:

解决办法:

手动降低 protobuf 为 3.x
pip install protobuf==3.20.1

完整报错:
image

(py39) C:\Users\Admin>hub install ge2e_fastspeech2_pwgan==1.0.0
Traceback (most recent call last):
File "f:\anaconda3\envs\py39\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "f:\anaconda3\envs\py39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "f:\anaconda3\envs\py39\Scripts\hub.exe_main
.py", line 4, in
File "f:\anaconda3\envs\py39\lib\site-packages\paddlehub_init
.py", line 18, in
import paddle
File "f:\anaconda3\envs\py39\lib\site-packages\paddle_init.py", line 25, in
from .framework import monkey_patch_variable
File "f:\anaconda3\envs\py39\lib\site-packages\paddle\framework_init_.py", line 17, in
from . import random # noqa: F401
File "f:\anaconda3\envs\py39\lib\site-packages\paddle\framework\random.py", line 16, in
import paddle.fluid as fluid
File "f:\anaconda3\envs\py39\lib\site-packages\paddle\fluid_init_.py", line 36, in
from . import framework
File "f:\anaconda3\envs\py39\lib\site-packages\paddle\fluid\framework.py", line 35, in
from .proto import framework_pb2
File "f:\anaconda3\envs\py39\lib\site-packages\paddle\fluid\proto\framework_pb2.py", line 33, in
_descriptor.EnumValueDescriptor(
File "f:\anaconda3\envs\py39\lib\site-packages\google\protobuf\descriptor.py", line 755, in new
_message.Message._CheckCalledFromGeneratedFile()
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).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

@Ligoml Ligoml removed status/new-issue 新建 type/others 其他问题 labels May 27, 2022
@TCChenlong TCChenlong pinned this issue May 27, 2022
@dingjiaweiww dingjiaweiww changed the title 关于安装paddle 2.3.0 版本遇到protobuf 的报错问题 关于安装paddle 发行版本遇到protobuf 的报错问题 May 27, 2022
@dingjiaweiww
Copy link
Contributor Author

dingjiaweiww commented May 27, 2022

protobuf 已经撤销了4.21 版本在pypi源上的发布( https://pypi.org/project/protobuf/4.21.0/ ) ,如果你使用pip install paddlepaddle 默认从pypi源下载依赖的话不会再遇到import paddle 报错,但是你从国内源下载(清华源、百度源等),则依然会下载protobuf 4.x,需要手动降低版本再使用paddle

@shixnjs
Copy link

shixnjs commented Jun 3, 2022

我也遇到了这一问题,但是当我手动降低版本后会出现
requests.exceptions.SSLError: HTTPSConnectionPool(host='paddleocr.bj.bcebos.com', port=443): Max retries exceeded with url: /PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

@SigureMo
Copy link
Member

SigureMo commented Jun 4, 2022

如果你使用pip install paddlepaddle 默认从pypi源下载依赖的话不会再遇到import paddle 报错

yank 的第二天就发布了 4.21.1,所以还会有这个问题

另外,降级是有效的(如 3.20.1),不会出现其他问题

@SigureMo
Copy link
Member

SigureMo commented Jun 4, 2022

我也遇到了这一问题,但是当我手动降低版本后会出现
requests.exceptions.SSLError: HTTPSConnectionPool(host='paddleocr.bj.bcebos.com', port=443): Max retries exceeded with url: /PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

这问题与此无关吧,建议另开 issue 详述问题

@2954456878
Copy link

pip install protobuf==3.20.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

@paddle-bot
Copy link

paddle-bot bot commented Jun 13, 2023

Since you haven't replied for more than a year, we have closed this issue/pr.
If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up.
由于您超过一年未回复,我们将关闭这个issue/pr。
若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants