Install MySQL Client in Django Show Error - python

Hi I am trying to install Mysqlclient in Django and I got this message
collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Complete output from command 'c:\users\usermo~1\virtua~1\tmsv2_~2\scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\userMO~1\\AppData\\Local\\Temp\\pip-install-vzfx29bg\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\userMO~1\AppData\Local\Temp\pip-wheel-rd_6y67h' --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" "-Ic:\users\user moe\appdata\local\programs\python\python37-32\include" "-Ic:\users\user moe\appdata\local\programs\python\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Complete output from command 'c:\users\usermo~1\virtua~1\tmsv2_~2\scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\userMO~1\\AppData\\Local\\Temp\\pip-install-vzfx29bg\\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\userMO~1\AppData\Local\Temp\pip-record-ea_7lykd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\usermo~1\virtua~1\tmsv2_~2\include\site\python3.7\mysqlclient':
ERROR: running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 "-IC:\Program Files
(x86)\MySQL\MySQL Connector C 6.1\include\mariadb" "-Ic:\users\user moe\appdata\local\programs\python\python37-32\include" "-Ic:\users\user moe\appdata\local\programs\python\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command "'c:\users\usermo~1\virtua~1\tmsv2_~2\scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\userMO~1\\AppData\\Local\\Temp\\pip-install-vzfx29bg\\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\userMO~1\AppData\Local\Temp\pip-record-ea_7lykd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\usermo~1\virtua~1\tmsv2_~2\include\site\python3.7\mysqlclient'" failed with error code 1 in C:\Users\userMO~1\AppData\Local\Temp\pip-install-vzfx29bg\mysqlclient\
I already tried several way
pip install opencv-contrib-python (can install no work)
pip install mysqlclient==1.3.12 (show same error)
I install the mycsqlclient from Wheel Link (show this error mysqlclient-1.4.2-cp38-cp38m-win_amd64.whl is not a supported wheel on this platform.)
My python version is: 3.7.3
(I come from desktop environment and while I read the Django, its say "Ridiculously fast" but now for MySQL connection problem took 4 days already).

You have downloaded the wrong wheel. The error message says you tried to install mysqlclient-1.4.2-cp38-cp38m-win_amd64.whl, which is for Python 3.8.
Since you are using Python 3.7, you should use either mysqlclient‑1.4.2‑cp37‑cp37m‑win32.whl or mysqlclient‑1.4.2‑cp37‑cp37m‑win_amd64.whl depending on whether you have installed 32-bit or 64-bit Python.

It seems like your Build Tools cannot handle some .h files. You can use unofficial precompiled package database to get already compiled mysqlclient.
After downloading it run
pip install name-of-whl-file.whl
If the python+win version of whl file fails to install, try using another version. Always works for me if Build Tools fail.

You can use pymysql
1.Install pymysql
pip install pymysql
Modify your init.py file
import pymysql
pymysql.install_as_MySQLdb()
You can start your project

I got the same error when I try to install mysqlclient in windows. after much time spent in this error. I found a result in the result install the latest visual studio and visual studio build tools. if programmer and only work on coding then transfer windows to ubuntu.i transfer on Ubuntu and enjoy coding

try this:
pip install mysqlclient-1.4.4-cp38-cp38-win_amd64.whl
if it did'nt work, then use the 32bit version
pip install mysqlclient-1.4.4-cp38-cp38-win32.whl

The best way to install mysql-client is to go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient and you will find many mysql-client wheels.
Download the first one #do not change the name of the file,,
open command prompt,
use cd to go to the directory where your wheel has been installed,
then use pip install (name of file) #use .whl as well
if it doesn't work, download the second one and repeat the process, if that doesn't work as well, keep on downloading until I guarantee you that at least one of them would be installed in your computer

Related

Python - Mysqldb install Error [ ERROR: Command errored out with exit status 1:]

I was able to install Mysqldb with the pip install mysql-python command before(in Pycharm), but after installing Visual Code yesterday, it now gives an error. I did everything. I installed Visual Studio Build Tools, deleted and installed Python and Anaconda, but it still won't install. What should I do?
pip install mysql-python
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip (108 kB)
Building wheels for collected packages: mysql-python
Building wheel for mysql-python (setup.py) ... \ WARNING: Subprocess output does not appear to be encoded as cp1254
error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\90539\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\90539\\AppData\\Local\\Temp\\pip-install-tn8inoxo\\mysql-python
\\setup.py'"'"'; __file__='"'"'C:\\Users\\90539\\AppData\\Local\\Temp\\pip-install-tn8inoxo\\mysql-python\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read
().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\90539\AppData\Local\Temp\pip-wheel-dk9sq9jv'
cwd: C:\Users\90539\AppData\Local\Temp\pip-install-tn8inoxo\mysql-python\
Complete output (33 lines):
C:\Users\90539\Anaconda3\lib\site-packages\setuptools\dist.py:669: UserWarning: Usage of dash-separated 'distribution-name' will not be supported in future versions. Please use the u
nderscore name 'distribution_name' instead
warnings.warn(
C:\Users\90539\Anaconda3\lib\site-packages\setuptools\dist.py:669: UserWarning: Usage of dash-separated 'build-requires' will not be supported in future versions. Please use the unde
rscore name 'build_requires' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
copying _mysql_exceptions.py -> build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.8\MySQLdb
creating build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.8\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -
D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -IC:\Users\90539\Anaconda3\include -IC:\Users\90539\Anaconda3\include "-IC:\Program Files (x86)\Micr
osoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\in
clude\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.8\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: i‡erme dosyas\x8d a‡\x8dlam\x8dyor: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for mysql-python
Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... / WARNING: Subprocess output does not appear to be encoded as cp1254
error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\90539\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\90539\\AppData\\Local\\Temp\\pip-install-tn8inoxo\\mysql-pyth
on\\setup.py'"'"'; __file__='"'"'C:\\Users\\90539\\AppData\\Local\\Temp\\pip-install-tn8inoxo\\mysql-python\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.re
ad().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\90539\AppData\Local\Temp\pip-record-ac858le3\install-reco
rd.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\90539\Anaconda3\Include\mysql-python'
cwd: C:\Users\90539\AppData\Local\Temp\pip-install-tn8inoxo\mysql-python\
Complete output (33 lines):
C:\Users\90539\Anaconda3\lib\site-packages\setuptools\dist.py:669: UserWarning: Usage of dash-separated 'distribution-name' will not be supported in future versions. Please use the
underscore name 'distribution_name' instead
warnings.warn(
C:\Users\90539\Anaconda3\lib\site-packages\setuptools\dist.py:669: UserWarning: Usage of dash-separated 'build-requires' will not be supported in future versions. Please use the un
derscore name 'build_requires' instead
warnings.warn(
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
copying _mysql_exceptions.py -> build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.8\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.8\MySQLdb
creating build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.8\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.8\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1)
-D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -IC:\Users\90539\Anaconda3\include -IC:\Users\90539\Anaconda3\include "-IC:\Program Files (x86)\Mi
crosoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\
include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program File
s (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.8\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: i‡erme dosyas\x8d a‡\x8dlam\x8dyor: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\90539\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\90539\\AppData\\Local\\Temp\
\pip-install-tn8inoxo\\mysql-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\90539\\AppData\\Local\\Temp\\pip-install-tn8inoxo\\mysql-python\\setup.py'"'"';f=getattr(tokenize, '"'"'ope
n'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\90539\AppData\Local\Temp
\pip-record-ac858le3\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\90539\Anaconda3\Include\mysql-python' Check the logs for full command
output.
Is it possible that your python version changed from 2.7 to some 3.x version? See the package documentation here, it reads:
MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently
supported. Python-3.0 will be supported in a future release. PyPy is
supported.
If you are now on 3.x try pip install mysqlclient.

Getting errors while installing mysql-python for flask

I am using python v3.7. I want to install mysql-python for flask application. I got ModuleNotFoundError: No module named 'MySQLdb', and searched on internet where I found that this can be solved by installing either mysql-python or mysqlclient.
But, when I tried to install mysql-python using command pip install mysql-python and got following errors. Please help to resolve them. Thank you.
Defaulting to user installation because normal site-packages is not writeable
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip (108 kB)
Building wheels for collected packages: mysql-python
Building wheel for mysql-python (setup.py): started
Building wheel for mysql-python (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Anshu\\AppData\\Local\\Temp\\pip-install-hx2vj4vu\\mysql-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\Anshu\\AppData\\Local\\Temp\\pip-install-hx2vj4vu\\mysql-python\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Anshu\AppData\Local\Temp\pip-wheel-rqv0mwcp'
cwd: C:\Users\Anshu\AppData\Local\Temp\pip-install-hx2vj4vu\mysql-python\
Complete output (29 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.7
copying _mysql_exceptions.py -> build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "-Ic:\program files (x86)\python37-32\include" "-Ic:\program files (x86)\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tc_mysql.c /Fobuild\temp.win32-3.7\Release\_mysql.obj /Zl
_mysql.c
c:\program files (x86)\python37-32\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for mysql-python
Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python: started
Running setup.py install for mysql-python: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Anshu\\AppData\\Local\\Temp\\pip-install-hx2vj4vu\\mysql-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\Anshu\\AppData\\Local\\Temp\\pip-install-hx2vj4vu\\mysql-python\\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\Anshu\AppData\Local\Temp\pip-record-q9lznfeo\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Anshu\AppData\Roaming\Python\Python37\Include\mysql-python'
cwd: C:\Users\Anshu\AppData\Local\Temp\pip-install-hx2vj4vu\mysql-python\
Complete output (29 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying _mysql_exceptions.py -> build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "-Ic:\program files (x86)\python37-32\include" "-Ic:\program files (x86)\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tc_mysql.c /Fobuild\temp.win32-3.7\Release\_mysql.obj /Zl
_mysql.c
c:\program files (x86)\python37-32\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Anshu\\AppData\\Local\\Temp\\pip-install-hx2vj4vu\\mysql-python\\setup.py'"'"'; __file__='"'"'C:\\Users\\Anshu\\AppData\\Local\\Temp\\pip-install-hx2vj4vu\\mysql-python\\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\Anshu\AppData\Local\Temp\pip-record-q9lznfeo\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Anshu\AppData\Roaming\Python\Python37\Include\mysql-python' Check the logs for full command output.
Sometimes people face same error with visual C++ tools, launch setup again and also select windows 8.1 / 10 SDK depending upon your OS. This will fix basestd.h error.
If it is still not working, try launching build tools from: C:\Program Files (x86)\Microsoft Visual C++ Build Tools.
Another alternative would be, just install anaconda 2 or 3 (64 bit if also you don't want memory errors). It contains all the important packages prebuilt: sklearn, matplotlib, scipy, numpy, pandas and even web development frameworks such as flask.
i hope this helps <3

How to fix "Failed building wheel for pyscipopt"?

I'm trying to install Pyscipopt for homework. There was an installation guide on the school website, the problem is that it doesn't work on my laptop. I have to write "pip install pyscipopt" in Anaconda Prompt, but I get the error "failed building wheel for pyscipopt". I don't know what it means or how to solve this, can anyone help me?
(base) C:\Users\claire>pip install pyscipopt
Collecting pyscipopt
Using cached https://files.pythonhosted.org/packages/a7/47/e3d5fcc37138c0eb9695d7c26e22b999c1274b06606db183c2aa36f98e5a/PySCIPOpt-2.2.0.tar.gz
Building wheels for collected packages: pyscipopt
Building wheel for pyscipopt (setup.py) ... error
ERROR: Complete output from command 'C:\Users\claire\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\claire\\AppData\\Local\\Temp\\pip-install-zja79xrm\\pyscipopt\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\claire\AppData\Local\Temp\pip-wheel-jnmor4q4' --python-tag cp37:
ERROR: Using include path <C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\src>.
Using SCIP library <scip> at <C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\lib>.
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\Multidict.py -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\__init__.py -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\scip.pyx -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\scip.pxd -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\benders.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\benderscut.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\branchrule.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\conshdlr.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\event.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\expr.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\heuristic.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\lp.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\presol.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\pricer.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\propagator.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\relax.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\sepa.pxi -> build\lib.win-amd64-3.7\pyscipopt
running build_ext
building 'pyscipopt.scip' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
creating build\temp.win-amd64-3.7\Release\src\pyscipopt
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\src -IC:\Users\claire\Anaconda3\include -IC:\Users\claire\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcsrc\pyscipopt\scip.c /Fobuild\temp.win-amd64-3.7\Release\src\pyscipopt\scip.obj
scip.c
src\pyscipopt\scip.c(621): fatal error C1083: Cannot open include file: 'scip/scip.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for pyscipopt
Running setup.py clean for pyscipopt
Failed to build pyscipopt
Installing collected packages: pyscipopt
Running setup.py install for pyscipopt ... error
ERROR: Complete output from command 'C:\Users\claire\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\claire\\AppData\\Local\\Temp\\pip-install-zja79xrm\\pyscipopt\\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\claire\AppData\Local\Temp\pip-record-aw3wx8lo\install-record.txt' --single-version-externally-managed --compile:
ERROR: Using include path <C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\src>.
Using SCIP library <scip> at <C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\lib>.
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\Multidict.py -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\__init__.py -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\scip.pyx -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\scip.pxd -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\benders.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\benderscut.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\branchrule.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\conshdlr.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\event.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\expr.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\heuristic.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\lp.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\presol.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\pricer.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\propagator.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\relax.pxi -> build\lib.win-amd64-3.7\pyscipopt
copying src\pyscipopt\sepa.pxi -> build\lib.win-amd64-3.7\pyscipopt
running build_ext
building 'pyscipopt.scip' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
creating build\temp.win-amd64-3.7\Release\src\pyscipopt
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\src -IC:\Users\claire\Anaconda3\include -IC:\Users\claire\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcsrc\pyscipopt\scip.c /Fobuild\temp.win-amd64-3.7\Release\src\pyscipopt\scip.obj
scip.c
src\pyscipopt\scip.c(621): fatal error C1083: Cannot open include file: 'scip/scip.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command "'C:\Users\claire\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\claire\\AppData\\Local\\Temp\\pip-install-zja79xrm\\pyscipopt\\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\claire\AppData\Local\Temp\pip-record-aw3wx8lo\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\
This is the actual error:
Cannot open include file: 'scip/scip.h': No such file or directory
To resolve it, please carry out the installation instructions as outlined here. Most importantly, you need to install the SCIP Optimization Suite first. You can get the Windows installer here. After installing, you need to set an environment variable telling the PySCIPOpt installer where to find the SCIP library for linking:
set SCIPOPTDIR="C:\Program Files\SCIPOptSuite-6.0.2"
pip install pyscipopt
(assuming you used the default installation path for the SCIPOptSuite)
I got this error trying to install python conda:
pip install conda
The error displayed was:
Building wheel for pycosat (setup.py) ... error
...
pycosat.c:10:10: fatal error: Python.h: No such file or directory 10 |
#include <Python.h>`
The solution was to install python3-dev, which has the required header.
sudo apt-get install python3-dev
The solution was here:
https://github.com/conda/pycosat/issues/34
It doesn't solve OP's specific problem, but I ended up here looking for a solution to this error.
Try this
pip install <package> --no-cache-dir

MYSQLdb with Python 3.6

I'm having a very hard time installing MYSQLdb under Python 3.6. I've been fighting with this for about a day now and was hoping someone had a fix. Note I am running Windows 10, MY SQL Workbench 6.3, PyCharm 2016.3.2, and Python 3.6 as already mentioned. To begin with, when trying to execute code in PyCharm which includes an import of MYSQLdb, I'd get an error saying no module found. So, I of course tried to pip install basically every binary possible. For most, I'd get the following:
C:\Users\[me]>pip install mysql-python
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
Running setup.py bdist_wheel for mysql-python ... error
Complete output from command c:\python36\python.exe -u -c "import
setuptools, tokenize;__file__='C:\\Users\\[me]\\AppData\\Local\\Temp\\pip-build-90yksnqx\\mysql-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\[me]\AppData\Local\Temp\tmprh_xynj1pip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying _mysql_exceptions.py -> build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.6\MySQLdb
creating build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.6\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\python36\include -Ic:\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.6\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
Failed building wheel for mysql-python
Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... error
Complete output from command c:\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\[me]\\AppData\\Local\\Temp\\pip-build-90yksnqx\\mysql-python\\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\[me]\AppData\Local\Temp\pip-h7ydssnj-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying _mysql_exceptions.py -> build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.6\MySQLdb
creating build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.6\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\python36\include -Ic:\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.6\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
So, I even then tried installing the unofficial binary for 3.6 available at http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
This installed fine, but still no luck when executing in PyCharm.
Next, I went into preferences=>project interpreter in PyCharm and tried to install MYSQLdb directly from there. With that, I get this other error:
Collecting MySQLdb
Could not find a version that satisfies the requirement MySQLdb (from versions: )
No matching distribution found for MySQLdb
From my research this seems to happen a lot when using new releases of Python. Does anyone know of a workaround or when 3.6 will be supported?
try to use sqlalchemy that is fully suported for many ODBC driver. Insted of using mysqldb, mysqlconnector is better in python3.x. I migrated a project from sqlite to mysql server and work fine in python3.6
sqlalchemy offer a solution for connecting with another ODBC.
I had this same issue.
I followed the advice of another answer and got to SQLAlchemy using the pip below:
pip install SQLAlchemy
I have been unable to play with it yet, but it did install without error, so here is hoping!
I had this issue before and I found out that when using python 3.6 you just need to install mysqlclient:
1 - create a folder and than a virtualenv (virtualenv myvenv --python python3)
2 - Install the django version you want (pip install django==1.9.3)
3- Install mysqlclient (pip install mysqlclient)
If you go inside myvenv folder/lib/python3.6/site-packages you will see that MySQLdb module will be there.

pip and installing mysql-python

I'm trying to install MySQL-Python through pip with pip install MySQL-Python. But I'm getting a couple of error messages. Here's the console log:
C:\WINDOWS\system32>pip install mysql-python
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
Running setup.py bdist_wheel for mysql-python ... error
Complete output from command c:\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Rasmus\\AppData\\Local\\Temp\\pip-build-cfm09c14\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\Rasmus\AppData\Local\Temp\tmps09l9dk_pip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
copying _mysql_exceptions.py -> build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.5\MySQLdb
creating build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.5\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\anaconda3\include -Ic:\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.5\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for mysql-python
Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... error
Complete output from command c:\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Rasmus\\AppData\\Local\\Temp\\pip-build-cfm09c14\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Rasmus\AppData\Local\Temp\pip-u6i7y7az-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
copying _mysql_exceptions.py -> build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.5\MySQLdb
creating build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.5\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\anaconda3\include -Ic:\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.5\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Rasmus\\AppData\\Local\\Temp\\pip-build-cfm09c14\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Rasmus\AppData\Local\Temp\pip-u6i7y7az-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Rasmus\AppData\Local\Temp\pip-build-cfm09c14\mysql-python\
I tried downloading the two whl files and install them 'manually' from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python but they give the error:
C:\WINDOWS\system32>pip install C:\Users\Rasmus\Downloads\MySQL_python-1.2.5-cp27-none-win_amd64.whl
MySQL_python-1.2.5-cp27-none-win_amd64.whl is not a supported wheel on this platform.
I used python 3.5, and windows 10.
It seems your pip version is outdated.
So first do python -m pip install --upgrade pip
Then use your downloaded wheel, but do python3 -m pip install [.whl_location] if python3 is in your path, else navigate to python3 folder and do the same.
Hope this helps.

Categories

Resources