python mysql installation failed - python

When I tried to install mysql in python
using this command python -m pip install mysql
can anyone help me with this?
Collecting mysql Using cached mysql-0.0.1.tar.gz Collecting
MySQL-python (from mysql) Using cached MySQL-python-1.2.5.zip
Installing collected packages: MySQL-python, mysql Running setup.py
install for MySQL-python ... error
Complete output from command C:\Users\vishnuvardhan12137\AppData\Local\Programs\Python\Python36-32\python.exe
-u -c "import setuptools, tokenize;file='C:\Users\VISHNU~1\AppData\Local\Temp\pip-build-lw04ypbu\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\VISHNU~1\AppData\Local\Temp\pip-0awclynb-record\install-record.txt
--single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.6
copying _mysql_exceptions.py -> build\lib.win32-3.6
creating build\lib.win32-3.6\MySQLdb
copying MySQLdb__init__.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.6\MySQLdb
creating build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants__init__.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.6\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools":
http://landinghub.visualstudio.com/visual-cpp-build-tools
---------------------------------------- Command "C:\Users\vishnuvardhan12137\AppData\Local\Programs\Python\Python36-32\python.exe
-u -c "import setuptools, tokenize;file='C:\Users\VISHNU~1\AppData\Local\Temp\pip-build-lw04ypbu\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\VISHNU~1\AppData\Local\Temp\pip-0awclynb-record\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
C:\Users\VISHNU~1\AppData\Local\Temp\pip-build-lw04ypbu\MySQL-python\

It says that it requires Microsoft Visual C++ 14.0. Have you tried installing that version of Microsoft Visual C++? And do take a look at this post too. Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)

Go to this website:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
Get your compatible mysqlclient version as per python version and windows version 32/64 bit then run following command
pip install mysqlclient-1.4.2-cp37-cp37m-win32.whl
in my case it was python 3.7 and 32-bit Windows so I downloaded such file mysqlclient-1.4.2-cp37-cp37m-win32.whl

Related

How can I install Zipline-trader without errors

I've tried installing zipline-trader according to instructions given on zipline-trader installation page: https://zipline-trader.readthedocs.io/en/latest/install.html
All goes fine until actually running the installation command. Neither of these work:
pip install -e .
or
pip install zipline-trader
Installation starts, but problems begin when starting to build wheel for zipline-trader.
I'm not a huge computer wizard, so if someone could help me out here and tell me where the problem is. it would be much appreciated.
The error messages are below (very long list):
Building wheels for collected packages: bcolz, bottleneck, lru-dict
Building wheel for bcolz (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\matti\Zipline\venv-zipline\Scripts\python.exe' -u -c 'import sys, setuptools,
tokenize; sys.argv[0] = '"'"'C:\\Users\\matti\\AppData\\Local\\Temp\\pip-install-
u0djao1v\\bcolz_ff25721e67224cf19d0fea2b456a1054\\setup.py'"'"';
__file__='"'"'C:\\Users\\matti\\AppData\\Local\\Temp\\pip-install-
u0djao1v\\bcolz_ff25721e67224cf19d0fea2b456a1054\\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\matti\AppData\Local\Temp\pip-wheel-yk9_l_0r'
cwd: C:\Users\matti\AppData\Local\Temp\pip-install-
u0djao1v\bcolz_ff25721e67224cf19d0fea2b456a1054\
Complete output (42 lines):
SSE2 detected
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\bcolz
copying bcolz\arrayprint.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\attrs.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\chunked_eval.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\ctable.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\defaults.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\py2help.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\py2help_tests.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\toplevel.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\utils.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\version.py -> build\lib.win-amd64-3.6\bcolz
copying bcolz\__init__.py -> build\lib.win-amd64-3.6\bcolz
creating build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\all.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\common.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\test_attrs.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\test_carray.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\test_carray_objects.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\test_ctable.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\test_ndcarray.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\test_queries.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\tests\__init__.py -> build\lib.win-amd64-3.6\bcolz\tests
copying bcolz\carray_ext.pxd -> build\lib.win-amd64-3.6\bcolz
running build_ext
skipping 'bcolz\carray_ext.c' Cython extension (up-to-date)
building 'bcolz.carray_ext' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
SSE2 detected
running bdist_wheel
running build
running build_py
copying bcolz\version.py -> build\lib.win-amd64-3.6\bcolz
running build_ext
skipping 'bcolz\carray_ext.c' Cython extension (up-to-date)
building 'bcolz.carray_ext' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for bcolz
Running setup.py clean for bcolz
Building wheel for bottleneck (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\matti\Zipline\venv-zipline\Scripts\python.exe' 'C:\Users\matti\Zipline\venv-
zipline\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel
'C:\Users\matti\AppData\Local\Temp\tmpi6jwni9b'
cwd: C:\Users\matti\AppData\Local\Temp\pip-install-
u0djao1v\bottleneck_4c2f93e8934942d2b56b70de3502ceed
Complete output (51 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\bottleneck
copying bottleneck\_pytesttester.py -> build\lib.win-amd64-3.6\bottleneck
copying bottleneck\_version.py -> build\lib.win-amd64-3.6\bottleneck
copying bottleneck\__init__.py -> build\lib.win-amd64-3.6\bottleneck
creating build\lib.win-amd64-3.6\bottleneck\benchmark
copying bottleneck\benchmark\autotimeit.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
copying bottleneck\benchmark\bench.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
copying bottleneck\benchmark\bench_detailed.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
copying bottleneck\benchmark\__init__.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
creating build\lib.win-amd64-3.6\bottleneck\slow
copying bottleneck\slow\move.py -> build\lib.win-amd64-3.6\bottleneck\slow
copying bottleneck\slow\nonreduce.py -> build\lib.win-amd64-3.6\bottleneck\slow
copying bottleneck\slow\nonreduce_axis.py -> build\lib.win-amd64-3.6\bottleneck\slow
copying bottleneck\slow\reduce.py -> build\lib.win-amd64-3.6\bottleneck\slow
copying bottleneck\slow\__init__.py -> build\lib.win-amd64-3.6\bottleneck\slow
creating build\lib.win-amd64-3.6\bottleneck\src
copying bottleneck\src\bn_config.py -> build\lib.win-amd64-3.6\bottleneck\src
copying bottleneck\src\bn_template.py -> build\lib.win-amd64-3.6\bottleneck\src
copying bottleneck\src\__init__.py -> build\lib.win-amd64-3.6\bottleneck\src
creating build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\input_modification_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\list_input_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\memory_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\move_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\nonreduce_axis_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\nonreduce_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\reduce_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\scalar_input_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\util.py -> build\lib.win-amd64-3.6\bottleneck\tests
copying bottleneck\tests\__init__.py -> build\lib.win-amd64-3.6\bottleneck\tests
UPDATING build\lib.win-amd64-3.6\bottleneck/_version.py
set build\lib.win-amd64-3.6\bottleneck/_version.py to '1.3.2'
running build_ext
running config
compiling '_configtest.c':
int __attribute__((optimize("O3"))) have_attribute_optimize_opt_3(void*);
int main(void)
{
return 0;
}
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for bottleneck
Building wheel for lru-dict (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\matti\Zipline\venv-zipline\Scripts\python.exe' -u -c 'import sys, setuptools,
tokenize; sys.argv[0] = '"'"'C:\\Users\\matti\\AppData\\Local\\Temp\\pip-install-u0djao1v\\lru-
dict_78af74fc04d748028bedabc5a1d6a84d\\setup.py'"'"';
__file__='"'"'C:\\Users\\matti\\AppData\\Local\\Temp\\pip-install-u0djao1v\\lru-
dict_78af74fc04d748028bedabc5a1d6a84d\\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\matti\AppData\Local\Temp\pip-wheel-qiws589m'
cwd: C:\Users\matti\AppData\Local\Temp\pip-install-u0djao1v\lru-
dict_78af74fc04d748028bedabc5a1d6a84d\
Complete output (5 lines):
running bdist_wheel
running build
running build_ext
building 'lru' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
`enter code here`https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for lru-dict
Running setup.py clean for lru-dict
Failed to build bcolz bottleneck lru-dict
ERROR: Could not build wheels for bottleneck which use PEP 517 and cannot be installed directly
From my experience of installing python packages, I think the problem is most likely dependencies and packages already installed in the python environment you are trying to install zipline trader. I suggest creating a new python environment with python version 3.6 and cloning the git and trying to install with that using these two commands:
git clone https://github.com/shlomikushchi/zipline-trader.git
then inside the directory that you downloaded that git:
pip install -e .
I did this in an anaconda environment and it worked for me.
You need this package for cloning git in anaconda:
conda install -c anaconda git
You can check out instructions here too.

Microsoft Visual C++ 14.0 is required - installing mysqldb for python

I am trying, in Windows 10, to install using pip MySQL-python as seen below. I am being told I need Microsoft Visual C++ 14 but I have installed Microsoft Visual Studio 11, 12, and 2017. 2017 should be providing me the required components if my research is accurate. I, also, installed Microsoft Build Tools. I am at a loss what is wrong. I am trying to migrate from my Ubuntu VM to native Windows with PyCharm. I have seen lots of other questions but none seem to have the answer I need.
C:\Environment\Python27>pip install MySQL-python
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
Complete output from command c:\users\efultz\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\efultz\\AppData\\Local\\Temp\\pip-build-3d7yo7lf\\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\efultz\AppData\Local\Temp\pip-wcici6ff-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying _mysql_exceptions.py -> build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.7\MySQLdb
creating build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
I never figured out the problem but I believe it was related to having both Python2 and Python3 installed on my machine. I uninstalled Python3 and was able, with a little more effort, to get things working. Hopefully when we do our migration to Python3 I won't return to having this problem.
If you want to install database i would go to Microsoft webpage (https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html) and install it from there.
As far as i know, you can't install database via python's pip.

pip install myclient error - on Windows 7 using Python 3.7.0

I'm currently working through a Django tutorial and after trying to install mysqlclient I have had the following error message on my CMD.
Many thanks in advance
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
Complete output from command c:\users\o\envs\py1\scripts\python.exe -u
-c "import setuptools,
tokenize;__file__='C:\\Users\\O\\AppData\\Local\\T
emp\\pip-install-kej8gk5_\\mysqlclient\\setup.py';f=getattr(tokenize,
'open', op
en)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, _
_file__, 'exec'))" install --record
C:\Users\O\AppData\Local\Temp\pip-reco
rd-_27hw8hl\install-record.txt --single-version-externally-managed --
compile --install-headers
c:\users\o\envs\py1\include\site\python3.7\mysqlclient:
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
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
i will recommend use python 64-bit.
This problem occured when mysql is of 64-bit and python is of 32-bit and when we forcefully install mysqlclient via this websitePython Extension Package
Or you can install both of 32-bit
pip install mysqlclient
or use this:pip install --only-binary :all: mysqlclient
Using 64-bit python you can easily install it.

building '_mysql' extension error: [WinError 2] The system cannot find the file specified

I have been trying to install mysqlclient to communicate with python but i always get this error below. I have tried installing from command prompt too but it says "module setup tools is not found"
can someone tell show me what's wrong? Thanks
I have been trying to install mysqlclient to communicate with python but i always get this error below. I have tried installing from command prompt too but it says "module setup tools is not found"
can someone tell show me what's wrong? Thanks
(venv) C:\Users\kesh\PycharmProjects\SplashSongs>pip3 install mysqlclient
Collecting mysqlclient
Using cached
https://files.pythonhosted.org/packages/ec
/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/
mysqlclient-1.3.13.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command
C:\Users\kesh\PycharmProjects\SplashSongs\venv\Scripts\python.exe -u
-c "import setuptools,
tokenize;__file__='C:\\Users\\kesh\\AppData\\Local\\Temp\\
pip-install-3qsuf31w\\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\kesh\AppData\Local\Temp\pip-record-6eq7cdv9\install-record.txt
--single-version-externally-managed --compile --install-headers \ Users\kesh\PycharmProjects\SplashSongs\venv\include\site\python3.5\mysqlclient:C:\Users\kesh\AppData\Local\Programs\Python\Python35\lib\distutils\dist.py:261:
UserWarning: Unknown distribution option:
'long_description_content_type' warnings.warn(msg)
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\compat.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\converters.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\CLIENT.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\ER.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\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.5\MySQLdb\constants
running build_ext
building '_mysql' extension
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command "C:\Users\kesh\PycharmProjects\SplashSongs\venv\Scripts\python.exe -u
-c "import setuptools,
tokenize;__file__='C:\\Users\\kesh\\AppData\\Local\\Temp\\pip-install-
3qsuf31w\\msqlclient\\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\kesh\ApData\Local\Temp\pip-
record-6eq7cdv9\install-record.txt --single-version-externally-managed --
compile --install-headers
C:\Users\kesh\PycharmProjects\SplashSongs\venv\include\site\python3.5\my
sqlclient" failed with error code 1 in C:\Users\kesh\AppData\Local\Temp\pip-
install-3qsuf31w\mysqlclient\
(venv) C:\Users\kesh\PycharmProjects\SplashSongs>pip3 install mysqlclient
Collecting mysqlclient
Using cached
https://files.pythonhosted.org/packages/ec
/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/
mysqlclient-1.3.13.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command
C:\Users\kesh\PycharmProjects\SplashSongs\venv\Scripts\python.exe -u
-c "import setuptools,
tokenize;__file__='C:\\Users\\kesh\\AppData\\Local\\Temp\\
pip-install-3qsuf31w\\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\kesh\AppData\Local\Temp\pip-record-6eq7cdv9\install-record.txt
--single-version-externally-managed --compile --install-headers \ Users\kesh\PycharmProjects\SplashSongs\venv\include\site\python3.5\mysqlclient:C:\Users\kesh\AppData\Local\Programs\Python\Python35\lib\distutils\dist.py:261:
UserWarning: Unknown distribution option:
'long_description_content_type' warnings.warn(msg)
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\compat.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb
copying MySQLdb\converters.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\CLIENT.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\ER.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\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.5\MySQLdb\constants
running build_ext
building '_mysql' extension
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command "C:\Users\kesh\PycharmProjects\SplashSongs\venv\Scripts\python.exe -u
-c "import setuptools,
tokenize;__file__='C:\\Users\\kesh\\AppData\\Local\\Temp\\pip-install-
3qsuf31w\\msqlclient\\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\kesh\ApData\Local\Temp\pip-
record-6eq7cdv9\install-record.txt --single-version-externally-managed --
compile --install-headers
C:\Users\kesh\PycharmProjects\SplashSongs\venv\include\site\python3.5\my
sqlclient" failed with error code 1 in C:\Users\kesh\AppData\Local\Temp\pip-
install-3qsuf31w\mysqlclient\
Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient and download a precompiled mysqlclient library for your python version. For an example if you are using python 3.6 32bit version, download
mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl
Then from either command prompt or pycharm terminal(pycharm terminal if you want to install for the virtual environment of your project) execute
pip install "Path for the downloaded .whl file"
That should install mysqlclient without a problem.

IMDBPy installing mysqlclient fails - Python 2.7 Windows

I'm a former developer, but haven't done much with Python to date. I'm trying to get the full IMDB database into a MySQL server before the text files go poof.
I now know IMDBPy requires Python 2.7 (thanks David!) so I am on a clean machine with Py 2.7 installed. My understanding is that I need several packages installed before I can run the imdbpy2sql script successfully.
These are:
Python 2.7
MySQL (using the latest version of community server 5.7.2)
SQL Object
mysqlclient (requires VC++ compliler for Python
2.7)
I have everything installed up to the mysqlclient. When I attempt to install it, it fails with a message that seems to indicate it cannot find the \include folder for MySQL.
C:\Windows\system32>pip install -U SQLObject
Collecting SQLObject
Downloading SQLObject-3.4.0-py2.py3-none-any.whl (1.7MB)
100% |################################| 1.8MB 652kB/s
Collecting PyDispatcher>=2.0.4 (from SQLObject)
Downloading PyDispatcher-2.0.5.tar.gz
Collecting FormEncode!=1.3.0,>=1.1.1 (from SQLObject)
Downloading FormEncode-1.3.1.tar.gz (197kB)
100% |################################| 204kB 3.3MB/s
Installing collected packages: PyDispatcher, FormEncode, SQLObject
Running setup.py install for PyDispatcher ... done
Running setup.py install for FormEncode ... done
Successfully installed FormEncode-1.3.1 PyDispatcher-2.0.5 SQLObject-3.4.0
C:\Windows\system32>pip install mysqlclient
Collecting mysqlclient
Downloading mysqlclient-1.3.12.tar.gz (89kB)
100% |################################| 92kB 837kB/s
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\\michael\\appdata\\local\\temp\\pip-build-jgsnac\\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\michael\appdata\local\temp\pip-uwgilx-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
copying _mysql_exceptions.py -> build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-2.7\MySQLdb
creating build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-2.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Users\Michael\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\python27\include -Ic:\python27\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.7\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(29) : fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Users\\Michael\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\michael\\appdata\\local\\temp\\pip-build-jgsnac\\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\michael\appdata\local\temp\pip-uwgilx-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\michael\appdata\local\temp\pip-build-jgsnac\mysqlclient\
I have confirmed the include folder is there as well as the mysql.h file it is looking for (the default installation location was "c:\Program Files\MySQL\MySQL Server 5.7\include"). I didn't have a problem installing mysqlclient when I was using a newer version of Python (3). So I'm assuming there's some disconnect between the 2.7 version and newer versions of MySQL. Maybe a config file that needs to be updated? Any help would be appreciated.
Install driver first and then try if it works.
Download & Install Python MySQL Connector driver from following link.
https://dev.mysql.com/downloads/connector/c/6.0.html#downloads
pip install MySQL-Python
Refer:
https://github.com/PyMySQL/mysqlclient-python/issues/142

Categories