Ted Mcgroder
Ted Mcgroder

Reputation: 55

Cannot Installing mysql-python cannot build or use wheel

I am trying to install mysql-python, I have tried two methods in pip

  1. python -m pip install mysql-python

    • This does not work saying "Failed Building Wheel for MySQL-Python"
  2. Downloading the wheels MySQL_python-1.2.5-cp27-none-win_amd64 and MySQL_python-1.2.5-cp27-none-win32 and trying to install each of them separately with the command python -m pip install filename

    • This does not work in each case saying it is "not supported on this platform'

Does any one know what is wrong and how I can install mysql-python?

Update

Since writing this I am still having trouble getting MySQLdb working but have tried a few more things.

1) I am using Python 3.5 mysql-python is for Python 2.x, I should have been trying to install mysqlclient. However I am now having similar issues as above installing mysqlclient both with wheels and with just pip.

> pip install mysqlclient




 Collecting mysqlclient
  Using cached mysqlclient-1.3.10.tar.gz
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\teddy\\appdata\\local\\temp\\pip-build-lhtha0\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\teddy\appdata\local\temp\pip-stnbio-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    copying _mysql_exceptions.py -> build\lib.win32-2.7
    creating build\lib.win32-2.7\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\compat.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\times.py -> build\lib.win32-2.7\MySQLdb
    creating build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\CR.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\ER.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\REFRESH.py -> build\lib.win32-2.7\MySQLdb\constants
    running build_ext
    building '_mysql' extension
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    C:\Users\teddy\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\python27\include -Ic:\python27\PC /Tc_mysql.c /Fobuild\temp.win32-2.7\Release\_mysql.obj /Zl
    _mysql.c
    _mysql.c(29) : fatal error C1083: Cannot open include file: 'my_config.h': No such file or directory
    error: command 'C:\\Users\\teddy\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\teddy\\appdata\\local\\temp\\pip-build-lhtha0\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\teddy\appdata\local\temp\pip-stnbio-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\teddy\appdata\local\temp\pip-build-lhtha0\mysqlclient\

2) I have tried installing MySQL connector C. This hasn't changed anything.

3) I have tried getting it working on Spyder the IDE that comes with Anaconda

So can anyone suggest anything else

Upvotes: 0

Views: 1936

Answers (1)

Ted Mcgroder
Ted Mcgroder

Reputation: 55

I finally did it. There were two things I changed to get it working:

  1. My Pip was pointing to an older version of Python I had on my computer and for some reason Idle was picking it up but not Spyder.
  2. I had to move one of the mysql connector files from:

C:\Program Files\MySQL to C:\Program Files (x86)\MySQL

Upvotes: 1

Related Questions