Search code examples
python-3.xpycharmprotocol-buffersobject-detectionprotoc

Python (PyCharm) - Protoc is not a recognized command


I realize there are other threads already, but none of the solutions are working for me. This is my error when trying to use the protoc command: Protoc.

I'm using Windows10 and a virtual environment in PyCharm using python 3.8 and pip is updated using the console command.
I installed protobuf with pip and then I've manually downloaded protoc following the installation guide on https://grpc.io/docs/protoc-installation/.

I have tried both adding the path to the protoc.exe file in my venv path variables and copying it to Tensorflow/models/research, but neither yields a positive result.

I've tried both protoc-21.1-win64.zip and protobuf-python-4.21.1.zip. I added the path to the protoc.exe folder when using the win64 version but I'm not sure which folder contains the file for the python version, although I see most people recommend to use the windows version anyways.

Through my PyCharm terminal in my C:\Users\Name\PycharmProjects\Project_Name I'm attempting to run

protoc object_detection/protos/*.proto --python_out=.

I have tried to run it from C:\Users\Name\PycharmProjects\Project_Name\venv as well if that should make a difference.


These are the most prominent threads I've attempted solutions from:

Cannot find `protoc` command

protoc object_detection/protos/*.proto: No such file or directory


Solution

  • Make sure you add the Protoc compiler to the path instead of adding it in PyCharm as that usually brings problems.