Error installing Jupyter-Notebook on Window with python 3.9 - python

Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\argon2
copying src\argon2\exceptions.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\low_level.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_ffi_build.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_legacy.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_password_hasher.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_utils.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\__init__.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\__main__.py -> build\lib.win-amd64-3.9\argon2
running build_clib
building 'argon2' library
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\extras
creating build\temp.win-amd64-3.9\extras\libargon2
creating build\temp.win-amd64-3.9\extras\libargon2\src
creating build\temp.win-amd64-3.9\extras\libargon2\src\blake2
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iextras\libargon2\src\..\include -Iextras\libargon2\src\blake2 -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include /Tcextras\libargon2\src\argon2.c /Fobuild\temp.win-amd64-3.9\extras\libargon2\src\argon2.obj
argon2.c
extras\libargon2\src\argon2.c(18): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for argon2-cffi
Failed to build argon2-cffi
ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
Getting this error when trying to install Jupyter-Notebook using pip install
I am using Python 3.9 and pip 20.2.3. I have installed Microsoft Visual C++ 2015-2019 Redistributable - 14.27.29112
Need help to get this resolved.

Try this:
python -m pip install jupyter notebook

I installed reinstalled visual c 2019 build tools via the installer from ms and then I upgraded pip using
python -m pip install --upgrade pip
after that it works. I am on python 3.7 installed via chocolatey

Based on my Experience I think Python 3.9 isn't supported yet for Jupyter, So what I did is I install the older version which is the Python 3.8.

Related

Why do I get this error when installing Jupyter notebook?

ERROR: Command errored out with exit status 1:
command: 'c:\users\nithi\appdata\local\programs\python\python39\python.exe' 'c:\users\nithi\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\nithi\AppData\Local\Temp\tmpba_qtkcq'
cwd: C:\Users\nithi\AppData\Local\Temp\pip-install-dq1r1ff8\argon2-cffi
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\argon2
copying src\argon2\exceptions.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\low_level.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_ffi_build.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_legacy.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_password_hasher.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_utils.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\__init__.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\__main__.py -> build\lib.win-amd64-3.9\argon2
running build_clib
building 'argon2' library
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\extras
creating build\temp.win-amd64-3.9\extras\libargon2
creating build\temp.win-amd64-3.9\extras\libargon2\src
creating build\temp.win-amd64-3.9\extras\libargon2\src\blake2
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iextras\libargon2\src\..\include -Iextras\libargon2\src\blake2 -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include /Tcextras\libargon2\src\argon2.c /Fobuild\temp.win-amd64-3.9\extras\libargon2\src\argon2.obj
argon2.c
extras\libargon2\src\argon2.c(18): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for argon2-cffi
Failed to build argon2-cffi
ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
I keep getting this error when I try to install jupyter notebook.
pip install notebook, this is the command I used on the command line.
One website suggested to install visual studio C++, Which I did and still no luck. Any help is appreciated. Thank you

I can't pip install Jupyter Notebook on Python3.9 [duplicate]

This question already has answers here:
Jupyter Notebook installation error - Building wheel for argon2-cffi (PEP 517) ... error
(7 answers)
Closed 2 years ago.
This is the error that I get when I try to pip install notebook.
I am using Python3.9. I installed VS C++ Build tools and restarted my machine too.
Still can't seem to get jupyter installed, can someone please help with this? Thanks!
ERROR: Command errored out with exit status 1:
command: 'c:\users\sahi0h\appdata\local\programs\python\python39\python.exe' 'c:\users\sahi0h\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\sahi0h\AppData\Local\Temp\tmpgkwkmc6k'
cwd: C:\Users\sahi0h\AppData\Local\Temp\pip-install-29y4gn0n\argon2-cffi
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\argon2
copying src\argon2\exceptions.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\low_level.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_ffi_build.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_legacy.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_password_hasher.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\_utils.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\__init__.py -> build\lib.win-amd64-3.9\argon2
copying src\argon2\__main__.py -> build\lib.win-amd64-3.9\argon2
running build_clib
building 'argon2' library
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\extras
creating build\temp.win-amd64-3.9\extras\libargon2
creating build\temp.win-amd64-3.9\extras\libargon2\src
creating build\temp.win-amd64-3.9\extras\libargon2\src\blake2
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iextras\libargon2\src\..\include -Iextras\libargon2\src\blake2 -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include /Tcextras\libargon2\src\argon2.c /Fobuild\temp.win-amd64-3.9\extras\libargon2\src\argon2.obj
argon2.c
extras\libargon2\src\argon2.c(18): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for argon2-cffi
Failed to build argon2-cffi
ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly```
Found kind of a solution -- I uninstalled Python3.9 and installed Python3.8. Pip install is working now.

Can't build mod_wsgi on Windows 10 - "Cannot open include file: 'ws2tcpip.h'" - Have VS 2019 Build tools

I have apache 2.4 installed (64 bit), python 3.7 (64 bit) (installed from Anaconda, if that matters) and VS 2019 C++ build tools, with the SDK and everything else required to build this checked. I still cannot build mod_wsgi with pip install. How can I get this to work on Windows 10?
I have tried uninstalling and reinstalling, python, visual studio & visual studio build tools, and apache. I have tried all the various visual studio command prompts. I have checked stack overflow, github, and other sites. There were others with similar issues but the solution of installing build tools did not work for me because a.) I already had it, b.) I reinstalled everything and it still didn't work.
pip install mod_wsgi
Resulting error message:
Collecting mod_wsgi
Using cached https://files.pythonhosted.org/packages/26/03/a3ed5abc2e66c82c40b0735c2f819c898d136879b00be4f5537126b6a4a4/mod_wsgi-4.6.7.tar.gz
Building wheels for collected packages: mod-wsgi
Building wheel for mod-wsgi (setup.py) ... error
ERROR: Complete output from command 'C:\Users\VC046230\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\VC046230\\AppData\\Local\\Temp\\pip-install-12r9v42f\\mod-wsgi\\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\VC046230\AppData\Local\Temp\pip-wheel-1q_bver8' --python-tag cp37:
ERROR: C:\Users\VC046230\AppData\Local\Continuum\anaconda3\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\mod_wsgi
copying src\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi
creating build\lib.win-amd64-3.7\mod_wsgi\server
copying src\server\apxs_config.py -> build\lib.win-amd64-3.7\mod_wsgi\server
copying src\server\environ.py -> build\lib.win-amd64-3.7\mod_wsgi\server
copying src\server\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\server
creating build\lib.win-amd64-3.7\mod_wsgi\server\management
copying src\server\management\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\server\management
creating build\lib.win-amd64-3.7\mod_wsgi\server\management\commands
copying src\server\management\commands\runmodwsgi.py -> build\lib.win-amd64-3.7\mod_wsgi\server\management\commands
copying src\server\management\commands\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\server\management\commands
creating build\lib.win-amd64-3.7\mod_wsgi\docs
copying docs\_build\html\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\docs
creating build\lib.win-amd64-3.7\mod_wsgi\images
copying images\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\images
copying images\snake-whiskey.jpg -> build\lib.win-amd64-3.7\mod_wsgi\images
running build_ext
building 'mod_wsgi.server.mod_wsgi' 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\server
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\Apache24/include -IC:\Users\VC046230\AppData\Local\Continuum\anaconda3\include -IC:\Users\VC046230\AppData\Local\Continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" /Tcsrc/server\mod_wsgi.c /Fobuild\temp.win-amd64-3.7\Release\src/server\mod_wsgi.obj
mod_wsgi.c
C:\Users\VC046230\AppData\Local\Temp\pip-install-12r9v42f\mod-wsgi\src\server\wsgi_apache.h(39): fatal error C1083: Cannot open include file: 'ws2tcpip.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for mod-wsgi
I just solved the same problem. My config is Windows 10, Python 3.8.1, Apache2.4.39-Win64-VC15-OpenSSL1.1.1b, mod-wsgi 4.7.1.
1) I installed using Build Tools
Visual Studio Build Tools Main Components
SDK for Windows 10 (10.0.18362.0) since I'm using Windows 10
MSVC 140 - C++ VS 2015 (v.14.00)
2) Then I added C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin to PATH
3) Then I got the next error:
'apr_perms_set.h': No such file or directory'.
I downloaded the file and put it into $APACHE_DIR\include
4) Then I got third error:
fatal error LNK1158: cannot run ‘rc.exe’.
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
I took following files rc.exe rcdll.dll from C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86 and paste them into C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
5) Congratulations!
To anyone who had this issue, the following github issue helped me resolve it: https://github.com/GrahamDumpleton/mod_wsgi/issues/194
I had already installed Visual C++ Redistributable, so I was confused why pip install mod_wsgi still was not working.
All I ended up having to do was install Windows 10 SDK from https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/
(might also need 8.1 if it still does not work)

Error while installing MySQL-python

I'm using Python 2.7 and Django 1.9.4. I want to integrate my Django application with MySQL 5.7 database and I executed:
pip install MySQL-python
on Windows 7 machine 64-bit.
And getting Error :
F:\Djangoproject\mysite>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:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\chandra\\appdata\\local\\temp\\pip-build
-3qbbxo\\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\chandra\appdata\local\temp\tmpoytuplpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-2.7
copying _mysql_exceptions.py -> build\lib.win32-2.7
creating build\lib.win32-2.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-2.7\MySQLdb
creating build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Users\Chandra\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info
=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\python27\include -Ic:\python27\PC /Tc_mys
ql.c /Fobuild\temp.win32-2.7\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:\\Users\\Chandra\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit statu
s 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:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\chandra\\appdata\\local\\temp\\pip-bui
ld-3qbbxo\\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\chandra\appdata\local\temp\pip-rskyc7-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
copying _mysql_exceptions.py -> build\lib.win32-2.7
creating build\lib.win32-2.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-2.7\MySQLdb
creating build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Users\Chandra\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_in
fo=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\python27\include -Ic:\python27\PC /Tc_m
ysql.c /Fobuild\temp.win32-2.7\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:\\Users\\Chandra\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit sta
tus 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\chandra\\appdata\\local\\temp\\pip-build-3qbbxo\\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\chandra\appdata\local\temp\pip-rskyc7-record\install-record.txt --single-version-externally-managed --compile" failed with error code
1 in c:\users\chandra\appdata\local\temp\pip-build-3qbbxo\MySQL-python\
The easiest way is to use precompiled python packages, which can be found here http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
You need a C compiler on your system. The easiest way is to use the on Microsoft provides.
https://www.microsoft.com/en-au/download/details.aspx?id=44266
About Python :
First check is python running properly in command prompt.
If not Download and install python 2.7.
Once it is downloaded, you generally have to go to Control Panel > System > Advanced System Settings > Advanced Tab > Environment Variables > Path > Edit. Here you need to add the Windows path of your Python installation. As an example, mine is “C:\Python27”. If you don’t add this to the Path variable, you won’t be able to run Python from the command line and it’ll be annoying to test things.
Install pip :
Next, we should install pip, the Python package manager (some of this section is from experience some from this stackoverflow page). In case you were wondering, Python 3.4 already has pip installed with it! But if you don’t have it there are a few options. If you have easy_install on your machine, you can simply navigate to the Python27\Scripts directory and type:
easy_install.exe pip
This should install pip for you. If you don’t have easy_install, you can download a python script from here. Make sure to save that get-pip.py file as a .py file not .txt. You can then run the script:
python get-pip.py
Once pip is installed, you can add the directory where pip is to your path like we did before (probably something like “C:\Python27\Scripts”).
About MySQL:
pip install mysql-python
You may get the error Unable to find vcvarsall.bat either when installing pip or other packages (I got it from trying to install mysql-python package). This means Windows can’t find a C/C++ compiler (it’s looking for Visual Studio) which pip uses to install packages and install itself.
Finally test it :
You can check if mysql-python is correctly installed by going to the command prompt and typing:
C:\> python
>>>import MySQLdb
Done with alot of research, even downloaded unofficial windows binaries for python extensions - again made disappointment.
Finally, after trying simply following command and it worked.
easy_install mysql-python
Best way is to install mysqlclient in the case of getting errors in installing mysql-python. mysqlclient is a fork of it and hence it can be used as a substitute and it contains MySQLdb aswell. So, better go for it

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.

Categories

Resources