title: Python project using protocol buffers, Deployment issues
body: <p>I have a Python project that uses setuptools for deployment and I mostly followed <a href="https://pythonhosted.org/setuptools/setuptools.html" rel="noreferrer">this guide</a> regarding project structure. The project uses Google Protocol Buffers to define a network message format. My main issue is how to make setup.py call the protoc-compiler during installation to build the definitions into a _pb2.py file.</p>
  
  <p>In <a href="https://stackoverflow.com/questions/23585450/automate-compilation-of-protobuf-specs-into-python-classes-in-setup-py">this question</a> the advice was given to just distribute the resulting _pb2.py files along with the project. While this might work for very similar platforms, I've found several cases where this does not work. For example, when I develop on a Mac that uses Anaconda Python and copy the resulting _pb2.py along with the rest of the project to a Raspberry Pi running Raspbian, there are always import errors coming from the _pb2.py modules. However, if I compile the .proto files freshly on the Pi, the project works as expected. So, distributing the compiled files does not seem like an option.</p>
  
  <p>Kind of looking for working and best practice solutions here. It can be assumed that the protoc-compiler is installed on the target platform.</p>
  
  <p>Edit:</p>
  
  <p>Since people ask for the reasons of the failure. On the Mac, the protobuf version is 2.6.1. and on the Pi it's 2.4.1. Apparently, the internal API as used by the generated protoc compiler output has changed. The output is basically:</p>
  
  <pre><code>  File "[...]network_manager.py", line 8, in &lt;module&gt;
        import InstrumentControl.transports.serial_bridge_protocol_pb2 as protocol
    File "[...]serial_bridge_protocol_pb2.py", line 9, in &lt;module&gt;
        from google.protobuf import symbol_database as _symbol_database
    ImportError: cannot import name symbol_database
  </code></pre>