3

I am currently trying to install version 3 of google protocol buffer on windows for python.

I have gone to the python folder through the command line and I am attempting to use:
python setup.py build

however I am getting the following error:
python : protoc is not installed nor found in ../src. Please compile it or install the binary package.

What's going on here?

Tom
  • 925
  • 3
  • 10
  • 24

2 Answers2

4

As the error says, you must first install protoc.exe. You can get it from the Win32 package included with every Protobuf release. The latest version is here:

https://github.com/google/protobuf/releases/download/v3.0.0-alpha-3/protoc-3.0.0-alpha-3-win32.zip

(You can also build protoc from source by downloading the C++ source code release.)

Kenton Varda
  • 41,353
  • 8
  • 121
  • 105
  • It says that the "binary needs to be somewhere in your PATH", is the path it refers to my python27 directory? – Tom Jun 26 '15 at 00:15
  • I put it in the python27 directory – Tom Jun 26 '15 at 06:11
  • `PATH` is an environment variable which lists places where the command shell will look for programs ([Wikipedia](https://en.wikipedia.org/wiki/PATH_(variable))). On Windows it typically includes things like "c:\windows" and "c:\windows\system32", but you can add other directories to it as well. On Windows, you can also place a program in the current working directory, and the command shell will find it. – Kenton Varda Jun 26 '15 at 18:01
  • 1
    Probably worth mentioning that the latest release is available here... https://github.com/google/protobuf/releases – Steve McDowell Sep 01 '15 at 14:39
  • As of 19th April 2018, `3.5.1` is the latest. – Pirate X Apr 19 '18 at 11:12
0

I was able to solve this issue, by following the steps below:

  1. Download the package which contains the precompiled version of Protoc from https://github.com/protocolbuffers/protobuf/releases. You will find the zip file at the bottom, in the assets section (e.g.,protoc-3.14.0-win32.zip)
  2. Add the path of your .exe file which is located inside the bin of the Protoc folder, to the system variables of your system.
  3. Open cmd and go to the directory where you have cloned the source code for the protocol buffer (https://github.com/protocolbuffers/protobuf). Get inside the python folder
  4. Check if python version 2.7 or newer is installed by running the command python -V. If yes then try the command, python setup.py build
  5. python setup.py install
  6. check the installed protoc version with protoc --version
Aishwarya Patil
  • 447
  • 5
  • 9
  • 1
    One small note to point 2, you don't need to add the **path of the .exe**, rather the **path of the bin** to system variables. Additionally, I found this comment useful too: https://github.com/protocolbuffers/protobuf/issues/1836#issuecomment-281205910 – lazarea May 13 '22 at 07:41