3

Context

This seems to be a question that has been asked several times before, but none of the answers I've found is clear enough and all of them seem to miss a step. I would like to use protocol buffer compiler in my Windows system. So that, I downloaded the latest release for Python https://github.com/protocolbuffers/protobuf/releases/tag/v3.8.0

Inside the zip, you can find a first README which reads "Protobuf supports several different programming languages. For each programming language, you can find instructions in the corresponding source directory about how to install protobuf runtime for that specific language".

So I go to the folder "Python" and open a second README which reads the following :

1) Make sure you have Python 2.7 or newer. If in doubt, run:

$ python -V

2) If you do not have setuptools installed, note that it will be downloaded and installed automatically as soon as you run setup.py[...].

3) Build the C++ code, or install a binary distribution of protoc. If you install a binary Build the C++ code distribution, make sure that it is the same version as this package. If in doubt, run:

$ protoc --version

Question

My issue here is, how I am supposed to install the binary distribution of protoc? Where is this binary distribution ? What do I need to do to install it ? Are the instructions for that in one of the many other folders contained in the zip file ? Which one ? I can see that there are many other README files, but I am worried about the idea of following randomly all these instructions without being sure about what I am doing.

So far, all the answers I've found out there are obscure or resend you to the beginning (e.g.: Where is protoc and how do i install it?)

Isa
  • 53
  • 2
  • 9

4 Answers4

5

I think the confusion that you, I and possibly many others have experienced is that there are two different types of files in the assets section of each release at Protobuf Releases

Don't get the protobuf-python-3.9.1.zip or similar file unless you want to build from source. Instead scroll farther down to get protoc-3.9.1-[platform].zip. This is the one with the compiled binary

Brad Dre
  • 3,580
  • 2
  • 19
  • 22
0

The protoc binary download link is at the bottom of release list which is the protobuf-python-3.x.x.zip or protobuf-python-3.x.x.tar.gz you had downloaded, the Windows 64bit OS should download the protoc-3.x.x-win64.zip

always stuck
  • 71
  • 1
  • 3
0

When you download the protoc-21.8-win64.zip (or similar) and unpack it, you see two directories in this package. The binary or executable can be found in the bin directory. To "install" it, you have to copy it in a directory, whose path is included in the PATH variable of the operating system. Since I have not done it in Windows, only in Mac OS, I can only specify the procesdure on Mac, but on Windows, it should be somewhat analogous.

  1. copy the protoc binary e.g. into the directory /usr/local/bin:

    cp ~/protoc-21.8-osx-universal_binary/bin/protoc /usr/local/bin/protoc

  2. if the path is not already included in the PATH variable:

    export PATH="/usr/local/bin:$PATH

Additionally, as mentioned in the readme.txt of the package, you can also copy the content of the include directory into /usr/local/include:

cp -R ~/protoc-21.8-osx-universal_binary/include/* /usr/local/include

The -R tag indicates that you are copying a directory, not a file. The * makes sure you copy all subdirectories.


The setup.py file that you need in the subsequent steps is in the package protobuf-python-4.21.8.tar.gz (or similar) in the python subdirectiory.

ChrisChros
  • 11
  • 2
-1

Brother, I was facing same issue and it took two freaking days to get it sorted. Very less documentation is available for Protocol Buffer so it is difficult.

1.The link you mentioned above go to that page. 2. Scroll down to assets section. 3. There you will find protobuf-python zip 4. I am sure you are not looking for this so just scroll to bottom of this assets section. 5. You will find the protoc zip . Downoad it for your OS version and follow the readme.

That's it!

Kundan Jha
  • 104
  • 3
  • 11