Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

protofile.proto: A file with this name is already in the pool

Having the following structure:

- project1
  - project1.py
  - protofile_pb2.py
  - protofile_pb2_grpc.py
- project2
  - project2.py
  - protofile_pb2.py
  - protofile_pb2_grpc.py

project1.py:

import protofile_pb2.py
...

project2.py:

import protofile_pb2
import project1
...

When running project2.py, I get this error:

TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "protofile.proto":
protofile.proto: A file with this name is already in the pool.
like image 317
Abdullah Raid Avatar asked Dec 14 '22 16:12

Abdullah Raid


1 Answers

According to this comment, it worked for me:

pip uninstall protobuf
pip install --no-binary protobuf protobuf
like image 172
Abdullah Raid Avatar answered Dec 27 '22 07:12

Abdullah Raid