0

I have tried 2 commands:

pip install mysql-python

and

pip install mysqlclient

Error for the pip install mysql-python

Command "C:\Users\Pops\Desktop\Martin\Programming\Python\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Pops\\AppData\\Local\\Temp\\pip-install-zfndvw17\\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\Pops\AppData\Local\Temp\pip-reco
rd-jpu7d9zb\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Pops\Desktop\Martin\Programming\Python\venv\include\site\python3.7\mysql-python" failed with er
ror code 1 in C:\Users\Pops\AppData\Local\Temp\pip-install-zfndvw17\mysql-python\

Error for the pip install mysqlclient

Command "C:\Users\Pops\Desktop\Martin\Programming\Python\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Pops\\AppData\\Local\\Temp\\pip-install-cn_nm0np\\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\Pops\AppData\Local\Temp\pip-recor
d-lyzr49kh\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Pops\Desktop\Martin\Programming\Python\venv\include\site\python3.7\mysqlclient" failed with erro
r code 1 in C:\Users\Pops\AppData\Local\Temp\pip-install-cn_nm0np\mysqlclient\

This is the download portion and seems to work fine until the end. (Just putting this here to fill-up more non-code text for stackoverflow to accept the revision)

Top portion prior to error:

Collecting mysqlclient
 Downloading https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz (90kB)
 100% |████████████████████████████████| 92kB 168kB/s
Installing collected packages: mysqlclient
 Running setup.py install for mysqlclient ... error
 Complete output from command C:\Users\Pops\Desktop\Martin\Programming\Python\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Pops\\AppData\\Local\\Temp\\pip-instal
l-cn_nm0np\\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\Pops\AppD
ata\Local\Temp\pip-record-lyzr49kh\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Pops\Desktop\Martin\Programming\Python\venv\include\site\python3.7\mysql
client:
 C:\Users\Pops\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
 warnings.warn(msg)
 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\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
 copying MySQLdb\constants\REFRESH.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
 cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -IC:\Users\Pops\Desktop\Martin\Pro
gramming\Python\venv\include -IC:\Users\Pops\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\Pops\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Windows Kits
10円\include10円.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits10円\include10円.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits10円\include10円.0.16299.0\winrt" "-IC:\Program Files (x86)\Win
dows Kits10円\include10円.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK4円.6.1\include\um" /Tc_mysql.c /Fobuild\temp.win32-3.7\Release\_mysql.obj /Zl
 error: command 'cl.exe' failed: No such file or directory
----------------------------------------
asked Jul 11, 2018 at 8:35
9
  • Try downloading mysqlclient module manually, extracting it and running python ./setup.py to see more detailed error messages. Commented Jul 11, 2018 at 8:39
  • Could you please post the part above the 'Command' error too? Commented Jul 11, 2018 at 8:44
  • @GRipepi added the other portions of the code in the main post. Commented Jul 11, 2018 at 8:47
  • @running.t Alright will I type python ./setup.py in the terminal? Commented Jul 11, 2018 at 8:48
  • do you have visual studio installed? Commented Jul 11, 2018 at 8:51

2 Answers 2

2

You have to add cl.exe into your PATH. It is generally located in (visual studio folder)\VC\bin directory. Add that to your PATH variable using the steps in here. After this restart the command prompt and you can use cl.exe from command prompt.

Alternatively you can download unofficial windows binaries for mysqlclient from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. And Install using pip install "path to the downloaded whl file"

answered Jul 11, 2018 at 8:57
Sign up to request clarification or add additional context in comments.

13 Comments

Hi, I do not have a bin folder. The paths for mine are: C:\Program Files (x86)\Microsoft Visual Studio2017円\Community\Common7\IDE\VC and C:\Program Files (x86)\Microsoft Visual Studio2017円\Community\VC but there are no bin folders for both
Microsoft Visual Studio2017円\Community\VC\Tools\MSVC14円.10.25017\bin\HostX64\x64\cl.exe check this path
I don't have a bin folder after the Microsoft Visual Studio2017円\Community\VC\Tools\MSVC14円.12.25827 and inside the folders there's no cl.exe. I don't have a 14.10.25017 folder as well only the one stated above
search for VCVARSALL.BAT file. According to MSDN docs(msdn.microsoft.com/en-us/library/f2ccy3wt.aspx) it will automatically add cl.exe to PATH.
Can't find that VCVARSALL.BAT file when I type it in the search box in My Computer
|
1

As I mentioned in the comment, you need to cl.exe folder. You can do it through Visual Studio installer. Install the following C++ compilers:

enter image description here

answered Jul 11, 2018 at 8:59

4 Comments

Still updating my VS installer will try it out in a while
Which ones specifically? All of those checked? That's a huge download
I know...ALL OF THEM
Thanks that is a waste of space. I read a similar post where people were complaining about 5GB worth of downloads

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.