minhanghuang / CyberRT

Baidu Apollo(v9.0.0) CyberRT Framework CMake Build
Apache License 2.0
186 stars 75 forks source link

cyber_service info 和 cyber_node list报错 #36

Closed Liyuanliu0011 closed 1 year ago

Liyuanliu0011 commented 1 year ago

楼主您好,在v8.0.0分支下,按照您的RM步骤进行安装测试,运行cyber_service info test_server和cyber_node list会报错,原本为尝试解决但是没找到思路,信息如下:

liuliyuan@liuliyuan-T14:~/Liuliyuan/github/CyberRT/build$ cyber_node list WARNING: Logging before InitGoogleLogging() is written to STDERR I0707 11:09:53.656744 362564 class_loader_utility.h:79] []registerclass:Circle,Base, I0707 11:09:53.656818 362564 class_loader_utility.h:79] []registerclass:Rect,Base, I0707 11:09:53.656833 362564 class_loader_utility.h:79] []registerclass:Triangle,Base, I0707 11:09:53.656844 362564 class_loader_utility.h:79] []registerclass:Star,Base, I0707 11:09:53.656857 362564 class_loader_utility.h:79] []registerclass:Apple,Base, I0707 11:09:53.656867 362564 class_loader_utility.h:79] []registerclass:Pear,Base, I0707 11:09:53.656877 362564 class_loader_utility.h:79] []registerclass:Banana,Base, I0707 11:09:53.656888 362564 class_loader_utility.h:79] []registerclass:Peach,Base, Traceback (most recent call last): File "/home/liuliyuan/Liuliyuan/github/CyberRT/build/bin/cyber_node", line 24, in <module> from cyber.proto.role_attributes_pb2 import RoleAttributes File "/home/liuliyuan/Liuliyuan/github/CyberRT/build/lib/python3.8/site-packages/cyber/proto/role_attributes_pb2.py", line 17, in <module> DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15role_attributes.proto\x12\x12\x61pollo.cyber.proto\x1a\x1d\x63yber/proto/qos_profile.proto\"&\n\nSocketAddr\x12\n\n\x02ip\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\r\"\xe0\x02\n\x0eRoleAttributes\x12\x11\n\thost_name\x18\x01 \x01(\t\x12\x0f\n\x07host_ip\x18\x02 \x01(\t\x12\x12\n\nprocess_id\x18\x03 \x01(\x05\x12\x11\n\tnode_name\x18\x04 \x01(\t\x12\x0f\n\x07node_id\x18\x05 \x01(\x04\x12\x14\n\x0c\x63hannel_name\x18\x06 \x01(\t\x12\x12\n\nchannel_id\x18\x07 \x01(\x04\x12\x14\n\x0cmessage_type\x18\x08 \x01(\t\x12\x12\n\nproto_desc\x18\t \x01(\x0c\x12\n\n\x02id\x18\n \x01(\x04\x12\x33\n\x0bqos_profile\x18\x0b \x01(\x0b\x32\x1e.apollo.cyber.proto.QosProfile\x12\x33\n\x0bsocket_addr\x18\x0c \x01(\x0b\x32\x1e.apollo.cyber.proto.SocketAddr\x12\x14\n\x0cservice_name\x18\r \x01(\t\x12\x12\n\nservice_id\x18\x0e \x01(\x04') TypeError: Couldn't build proto file into descriptor pool: Depends on file 'cyber/proto/qos_profile.proto', but it has not been loaded

电脑上的python版本如下: python3 --version Python 3.8.10 python --version Python 2.7.18

楼主有空的时候能帮忙看一下吗?谢谢 ^_^

minhanghuang commented 1 year ago

@Liyuanliu0011 确认一下Python的protobuf==3.14.0版本

Liyuanliu0011 commented 1 year ago

@minhanghuang

在setup.bash环境里可以看到如下:

liuliyuan@liuliyuan-T14:~/Liuliyuan/github/CyberRT/build$ protoc --version 
libprotoc 3.14.0

但脱离环境以后就执行不了,不知有没有影响

liuliyuan@liuliyuan-T14:~$ python3 -m pip install protobuf==3.14.0
Requirement already satisfied: protobuf==3.14.0 in ./.local/lib/python3.8/site-packages (3.14.0)
Requirement already satisfied: six>=1.9 in /usr/lib/python3/dist-packages (from protobuf==3.14.0) (1.14.0)
liuliyuan@liuliyuan-T14:~$ sudo python3 -m pip install protobuf==3.14.0
[sudo] password for liuliyuan: 
Collecting protobuf==3.14.0
  Downloading protobuf-3.14.0-cp38-cp38-manylinux1_x86_64.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 499 kB/s 
Requirement already satisfied: six>=1.9 in /usr/lib/python3/dist-packages (from protobuf==3.14.0) (1.14.0)
ERROR: grpcio-tools 1.56.0 has requirement protobuf<5.0dev,>=4.21.6, but you'll have protobuf 3.14.0 which is incompatible.
Installing collected packages: protobuf
  Attempting uninstall: protobuf
    Found existing installation: protobuf 4.23.3
    Uninstalling protobuf-4.23.3:
      Successfully uninstalled protobuf-4.23.3
Successfully installed protobuf-3.14.0
liuliyuan@liuliyuan-T14:~$ pro
pro    prove  

由于之前报错过,提示安装 grpcio和grpcio-tools,不知是不是有影响?

Liyuanliu0011 commented 1 year ago

root@liuliyuan-T14:/home/liuliyuan/Liuliyuan/github/CyberRT/build# cyber_node list WARNING: Logging before InitGoogleLogging() is written to STDERR I0707 15:11:52.968847 377763 class_loader_utility.h:79] []registerclass:Circle,Base, I0707 15:11:52.968919 377763 class_loader_utility.h:79] []registerclass:Rect,Base, I0707 15:11:52.968930 377763 class_loader_utility.h:79] []registerclass:Triangle,Base, I0707 15:11:52.968936 377763 class_loader_utility.h:79] []registerclass:Star,Base, I0707 15:11:52.968945 377763 class_loader_utility.h:79] []registerclass:Apple,Base, I0707 15:11:52.968950 377763 class_loader_utility.h:79] []registerclass:Pear,Base, I0707 15:11:52.968957 377763 class_loader_utility.h:79] []registerclass:Banana,Base, I0707 15:11:52.968963 377763 class_loader_utility.h:79] []registerclass:Peach,Base, Traceback (most recent call last): File "/home/liuliyuan/Liuliyuan/github/CyberRT/build/bin/cyber_node", line 24, in from cyber.proto.role_attributes_pb2 import RoleAttributes File "/home/liuliyuan/Liuliyuan/github/CyberRT/build/lib/python3.8/site-packages/cyber/proto/role_attributes_pb2.py", line 8, in from google.protobuf.internal import builder as _builder ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/local/lib/python3.8/dist-packages/google/protobuf/internal/init.py)

这个也让我比较困惑... 楼主有空帮忙一下,感谢感谢

minhanghuang commented 1 year ago

root@liuliyuan-T14:/home/liuliyuan/Liuliyuan/github/CyberRT/build# cyber_node list WARNING: Logging before InitGoogleLogging() is written to STDERR I0707 15:11:52.968847 377763 class_loader_utility.h:79] []registerclass:Circle,Base, I0707 15:11:52.968919 377763 class_loader_utility.h:79] []registerclass:Rect,Base, I0707 15:11:52.968930 377763 class_loader_utility.h:79] []registerclass:Triangle,Base, I0707 15:11:52.968936 377763 class_loader_utility.h:79] []registerclass:Star,Base, I0707 15:11:52.968945 377763 class_loader_utility.h:79] []registerclass:Apple,Base, I0707 15:11:52.968950 377763 class_loader_utility.h:79] []registerclass:Pear,Base, I0707 15:11:52.968957 377763 class_loader_utility.h:79] []registerclass:Banana,Base, I0707 15:11:52.968963 377763 class_loader_utility.h:79] []registerclass:Peach,Base, Traceback (most recent call last): File "/home/liuliyuan/Liuliyuan/github/CyberRT/build/bin/cyber_node", line 24, in from cyber.proto.role_attributes_pb2 import RoleAttributes File "/home/liuliyuan/Liuliyuan/github/CyberRT/build/lib/python3.8/site-packages/cyber/proto/role_attributes_pb2.py", line 8, in from google.protobuf.internal import builder as _builder ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/local/lib/python3.8/dist-packages/google/protobuf/internal/init.py)

这个也让我比较困惑... 楼主有空帮忙一下,感谢感谢

hi @Liyuanliu0011 from cyber.proto.role_attributes_pb2 import RoleAttributes这个问题是没有生成Python的protobuf文件导致的, 已修复

Liyuanliu0011 commented 1 year ago

@minhanghuang 非常感谢!点赞。