pythonmysqlmysql-connectormysql-connect

Why is pip install mysql-connector fail?


I'm just trying to simply install python-myconnector using the very simple instructions provided here.

But it is failing. Here is the error I get:

(my_virtual_env) [my.username@my_machine ~]$ pip install mysql-connector
...
Command "/home/my.username/my_virtual_env/bin/python2.7 -u -c 
  "import setuptools, tokenize;
  __file__='/tmp/pip-build-rLJbLN/mysql-connector/setup.py';
  f=getattr(tokenize, 'open', open)(__file__);
  code=f.read().replace('\r\n', '\n');f.close();
  exec(compile(code, __file__, 'exec'))" install 
  --record /tmp/pip-mFh5Pg-record/install-record.txt 
  --single-version-externally-managed 
  --compile 
  --install-headers 
  /home/me/my_virtual_env/include/site/python2.7/mysql-connector" 
  failed with error code 1 in /tmp/pip-build-rLJbLN/mysql-connector/```

The full error log can be found here if you need to see it (but I doubt you will)

Why is this happening and how can I fix it?? Also, FYI, I don't have sudo access on this machine. So that's why I am installing it into a virtual environment..

FYI, it seems like it was supposed write something into /tmp/pip-build-rLJbLN/ but didn't and then it blows up later on when it tries to read from what it was supposed to have written there earlier. So how do I fix this bug??

I have read other solutions to other similar problem here. But I couldn't get any of them to work for me.


Solution

  • The mysql-connector clearly states that it requires protobuf

    mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0)

    Just as I commented, your error log insists the same:

    Line 81, 165: Unable to find Protobuf include directory.

    Based on your platform, follow this protobuf C++ installaion instruction, and export the protobuf path so that pip can refer that path