mysqlclient icon indicating copy to clipboard operation
mysqlclient copied to clipboard

Not working with python 3.5

Open piyushspss opened this issue 11 years ago • 65 comments

This is the error I get when I try installing mysqlclient. I am using Windows and python 3.5.

Installing 'mysqlclient'
Collecting mysqlclient
  Using cached mysqlclient-1.3.6.tar.gz
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient
    Complete output from command "c:\users\buccaneer\documents\visual studio            2013\Projects\del1\del1\envrm\Scripts\python.exe" -c "import setuptools, tokenize;__file__='C:\\Users\\BUCCAN~1\\AppData\\Local\\Temp\\pip-build-wuhkxhu3\\mysqlclient\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\BUCCAN~1\AppData\Local\Temp\pip-3jbluuk2-record\install-record.txt --single-version-externally-managed --compile --install-headers "c:\users\buccaneer\documents\visual studio 2013\Projects\del1\del1\envrm\include\site\python3.5\mysqlclient":
running install
running build
running build_py
creating build
creating build\lib.win32-3.5
copying _mysql_exceptions.py -> build\lib.win32-3.5
creating build\lib.win32-3.5\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.5\MySQLdb
creating build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.5\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat

piyushspss avatar Sep 25 '15 13:09 piyushspss

Thanks @jokey2k it works for me.

ghost avatar Feb 04 '16 22:02 ghost

I put 32 and 64-bit wheels for Python 3.5 at http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. These are linked to the multi-threaded DLL runtime (/MD) versions of mysqlclient 5.7.11 for VC14.

cgohlke avatar Feb 09 '16 00:02 cgohlke

Thank You @cgohlke so much!!!

adanilins avatar Feb 10 '16 16:02 adanilins

FYI:

MySQL 5.6.29 was released Changes in MySQL 5.6.29 (2016-02-05)

and from above, it seem to have been resolved VS2015 problem.

tomoh1r avatar Feb 11 '16 02:02 tomoh1r

I'm waiting new release of MySQL Connector/C

methane avatar Feb 11 '16 02:02 methane

thank you so much !!!

PhilippePlagnol avatar Feb 12 '16 02:02 PhilippePlagnol

Works a charm via pip install. Wondering if anyone knows a way to install the wheel in a virtualenv in PyCharm? Otherwise no worries, I'll just make it available to the whole of 3.5.

boolbag avatar Feb 27 '16 10:02 boolbag

Thanks @jokey2k. It works for me. I am using Windows 7 64bit and Python 3.5 installed via Anaconda.

akbarpn136 avatar Mar 30 '16 12:03 akbarpn136

Can someone please explain how to implement @jokey2k 's solution step by step? Thanks.

ryanhalabi avatar Apr 20 '16 08:04 ryanhalabi

@ryanhalabi

  1. Install MySQL server (amd64) with client library.
  2. Build mysqlclient-python (amd64) with it
  3. Uninstall MySQL server.
  4. Install MySQL server (x86) with client library.
  5. Build mysqlclient-python (x86) with it
  6. Uninstall MySQL server

I know it, but I don't want to do it... Why MySQL developer don't release MySQL Connector/C for such a long time? It's very annoying.

methane avatar Apr 20 '16 12:04 methane

Thanks @jokey2k the solution worked for me. windows 10, 64 bit system and python 3.5

Ihure avatar Apr 26 '16 07:04 Ihure

thanks @cgohlke ; +100 internets to you :+1:

TalatCikikci avatar Aug 25 '16 14:08 TalatCikikci

thank you @cgohlke for linking to the 32-bit .whl :D

kryogenic avatar Sep 01 '16 17:09 kryogenic

If you get the error with vcvarsall.bat you could also try to set these environment variables: set DISTUTILS_USE_SDK=1 set MSSdk=1 set PY_VCRUNTIME_REDIST="No Thanks" this works for msvc2013

for later msvc you must set PY_VCRUNTIME_REDIST to a correct path.

This is general the case if you compile modules.

the missing include is fixed after extracting mysql with include directory and setting the INCLUDE environment variable for cl correctly. (also linker variable for sure)

I got it only worky by setting the code page to normal windows code page ("chcp 1252"). Normally i must set it to 65001 cause some modules require this to work.

kreuzberger avatar Sep 02 '16 11:09 kreuzberger

@kreuzberger Do you mean use msvc2013 (VC13) to build Python 3.5 (based on VC14 runtime) extension module? Is it really safe?

methane avatar Sep 02 '16 11:09 methane

no, sorry for the misunderstanding. I compile python myself with vs2013 too. Mixing is no good idea. but its python 3.5 as asked in the questions.

kreuzberger avatar Sep 02 '16 11:09 kreuzberger

Hmmm. Why Oracle doesn't release MySQL Connector/C for VC14 for such a long time.... Very annoying...

methane avatar Sep 02 '16 11:09 methane

Hi @jokey2k. I am new to django, can you please create the instruction on how to use the whl file you have provided? thanks!

carloliwanag avatar Sep 02 '16 15:09 carloliwanag

I've managed to build by myself and uploaded binary wheel for CPython 3.5 amd64. (Building all on Windows from source was not a fun task...)

Can anyone try this?

https://github.com/PyMySQL/mysqlclient-python/releases/download/1.3.7/mysqlclient-1.3.7-cp35-cp35m-win_amd64.whl

methane avatar Sep 05 '16 09:09 methane

I succeeded to build MySQL clientlib in MySQL 5.7.15 in this weekend. I'll release next bugfix version with Python 3.5 Win64 binary wheel.

methane avatar Sep 12 '16 07:09 methane