Bug #85666 Failed mysql-connector-python installation Unable to find Protobuf include dire
Submitted: 28 Mar 2017 8:30 Modified: 28 Mar 2017 10:33
Reporter: Shahriyar Rzayev Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / Python Severity:S1 (Critical)
Version:2.2.3 OS:CentOS (7)
Assigned to: CPU Architecture:Any

[28 Mar 2017 8:30] Shahriyar Rzayev
Description:
Trying setup my project but failed as:

Searching for mysql-connector>=2.0.2
Reading https://pypi.python.org/simple/mysql-connector/
Downloading https://pypi.python.org/packages/e8/b4/b178e9f26261b4ab57189d74c50788d97649b58ba3e83a68ebf...
Best match: mysql-connector 2.2.3
Processing mysql-connector-2.2.3.tar.gz
Writing /tmp/easy_install-86ee1hta/mysql-connector-2.2.3/setup.cfg
Running mysql-connector-2.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-86ee1hta/mysql-connector-2.2.3/egg-dist-tmp-w_nn2aii
# Python architecture: 64-bit
# Python ARCH_64BIT: True
Unable to find Protobuf include directory.
error: Setup script exited with 1

The same issue is here:

http://stackoverflow.com/questions/43029672/unable-to-find-protobuf-include-directory

How to repeat:
See description
[28 Mar 2017 8:40] Shahriyar Rzayev
The workaround was to install old version:

pip install mysql-connector==2.1.4
[28 Mar 2017 10:33] Chiranjeevi Battula
Hello  Shahriyar,

Thank you for the bug report.
Developer answer in Stackoverflow site.

As of 2.2.3, Connector/Python uses a C++ extension that interfaces with a MySQL server with the X plugin enabled, using Protobuf as data interchange format.

So, you need to set up where Protobuf is installed on your system (the library, include and protoc binary paths).

Requirements

A C/C++ compiler, such as gcc
Protobuf C++ (version >= 2.6.0)
Python development files
Installation

You have two options when using pip + pypi:

1) Set environment variables for MYSQLXPB_PROTOBUF_INCLUDE_DIR, MYSQLXPB_PROTOBUF_LIB_DIR and MYSQLXPB_PROTOC.

2) Add --install-option to set these options when using pip:

shell> python install mysql-connector --install-option='--with-protobuf-include-dir=<path>' --install-option='--with-protobuf-lib-dir=<path>' --install-option='--with-protoc=<path>'

Important: Keep in mind that 2.2.3 is a development release.

Thanks,
Chiranjeevi.
[31 Mar 2017 16:29] Markus Gerstel
RHEL7 user here. To my knowledge we don't have that library available on our machines. The development version is the version selected by default with "pip install".
[20 Sep 2017 12:22] Ondrej Medek
Hello  Chiranjeevi,
since out server does not use X plugin, is it possible to install 2.2.3 (and later) without protobuf?