Cant find the right way to install mysqlclient












1















I've been trying to install mysqlclient for my python 3.7.2 for quite some time now.
Currently using windows 10, python 3.7.2 and wamp server 2.1



I tried using the following



1) pip install mysqlclient



2) pip install c:mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
and everything along those lines
Checked this link: Installing mysqlclient in Python 3.6 in windows



3)pip install "mysqlclient==1.3.12"



4) pip install --only-binary :all: mysqlclient



5)pip install mysql-connector-python



I tried doing all of the above using cmd (as administrator) and that failed as well.



Anyone with any sort of solution for this problem are welcome! Thank you in advance!



PS the connector installs but I still cant migrate.
It gives me the following error



Traceback (most recent call last):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 15, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 357, in execute
django.setup()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjango__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsregistry.py", line 112, in populate
app_config.import_models()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsconfig.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:UsersSOISPycharmProjectsBuggieIssuesmodels.py", line 8, in <module>
from django.contrib.auth.models import User, Group
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthmodels.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthbase_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 101, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 305, in add_to_class
value.contribute_to_class(cls, name)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsoptions.py", line 203, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodb__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?


And when i try to install mysqlclient:



  ----------------------------------------
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:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pi
p-install-qanlzr18\mysqlclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --reco
rd C:UsersSOISAppDataLocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating buildlib.win32-3.7
copying _mysql_exceptions.py -> buildlib.win32-3.7
creating buildlib.win32-3.7MySQLdb
copying MySQLdb__init__.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcompat.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconnections.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconverters.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcursors.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbrelease.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbtimes.py -> buildlib.win32-3.7MySQLdb
creating buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win32-3.7MySQLdbconstants
running build_ext
building '_mysql' extension
creating buildtemp.win32-3.7
creating buildtemp.win32-3.7Release
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023binHostX86x86cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,3,14,'final',0)
-D__version__=1.3.14 "-IC:Program Files (x86)MySQLMySQL Connector C 6.1include" -Ic:userssoisappdatalocalprogramspythonpython37-32include -Ic:userssoisappdatalocalprogra
mspythonpython37-32include "-IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023Include" "-IC:Program Files (x86)Microsoft Visual Studio2017
BuildToolsVCToolsMSVC14.16.27023ATLMFCInclude" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0
um" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0ucrt" "-IC:Program Files (x86)Windows KitsNET
FXSDK4.6.1includeum" /Tc_mysql.c /Fobuildtemp.win32-3.7Release_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:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe' failed with exit status 2

----------------------------------------
Command "c:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pip-install-qanlzr18\mysq
lclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersSOISAppData
LocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersSOISAppDataLocalTemppip-install-qanlzr18mysqlc
lient


PS: I've already installed the latest visual studio build tools (2017)










share|improve this question

























  • Installing mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl isn't going to work on Python 3.7 - as cp36 suggests in the filename, it's for Python 3.6. If you want to use mysqlconnector-python instead of Django, then you need to update the ENGINE in your DATABASES setting (docs).

    – Alasdair
    Jan 2 at 20:28













  • Are you running 32 bit Python? There is are wheels for the latest release 1.3.14, but they are only for Python 3.6 and 3.7 on 64-bit Windows. Perhaps you could [try re-installing] Python, but choose one of the x86-64 options.

    – Alasdair
    Jan 2 at 20:35













  • I tried installing a different version but I still end up getting the same error. I tried with python 3.7.1 32 bit and 64 bit. python 3.7.2 32 bit and 64 bit and also with python 2.7 32&64 bit.

    – Kaushal Sharma
    Jan 3 at 8:54













  • Giving a long list of things that didn’t work doesn’t gives us enough information to help you. Focus on one combination that should work (e.g. Python 3.7 (64 bit), and mysqlclient 1.3.14), show the exact commands you ran and the full error message.

    – Alasdair
    Jan 3 at 9:12
















1















I've been trying to install mysqlclient for my python 3.7.2 for quite some time now.
Currently using windows 10, python 3.7.2 and wamp server 2.1



I tried using the following



1) pip install mysqlclient



2) pip install c:mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
and everything along those lines
Checked this link: Installing mysqlclient in Python 3.6 in windows



3)pip install "mysqlclient==1.3.12"



4) pip install --only-binary :all: mysqlclient



5)pip install mysql-connector-python



I tried doing all of the above using cmd (as administrator) and that failed as well.



Anyone with any sort of solution for this problem are welcome! Thank you in advance!



PS the connector installs but I still cant migrate.
It gives me the following error



Traceback (most recent call last):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 15, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 357, in execute
django.setup()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjango__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsregistry.py", line 112, in populate
app_config.import_models()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsconfig.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:UsersSOISPycharmProjectsBuggieIssuesmodels.py", line 8, in <module>
from django.contrib.auth.models import User, Group
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthmodels.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthbase_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 101, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 305, in add_to_class
value.contribute_to_class(cls, name)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsoptions.py", line 203, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodb__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?


And when i try to install mysqlclient:



  ----------------------------------------
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:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pi
p-install-qanlzr18\mysqlclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --reco
rd C:UsersSOISAppDataLocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating buildlib.win32-3.7
copying _mysql_exceptions.py -> buildlib.win32-3.7
creating buildlib.win32-3.7MySQLdb
copying MySQLdb__init__.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcompat.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconnections.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconverters.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcursors.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbrelease.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbtimes.py -> buildlib.win32-3.7MySQLdb
creating buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win32-3.7MySQLdbconstants
running build_ext
building '_mysql' extension
creating buildtemp.win32-3.7
creating buildtemp.win32-3.7Release
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023binHostX86x86cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,3,14,'final',0)
-D__version__=1.3.14 "-IC:Program Files (x86)MySQLMySQL Connector C 6.1include" -Ic:userssoisappdatalocalprogramspythonpython37-32include -Ic:userssoisappdatalocalprogra
mspythonpython37-32include "-IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023Include" "-IC:Program Files (x86)Microsoft Visual Studio2017
BuildToolsVCToolsMSVC14.16.27023ATLMFCInclude" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0
um" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0ucrt" "-IC:Program Files (x86)Windows KitsNET
FXSDK4.6.1includeum" /Tc_mysql.c /Fobuildtemp.win32-3.7Release_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:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe' failed with exit status 2

----------------------------------------
Command "c:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pip-install-qanlzr18\mysq
lclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersSOISAppData
LocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersSOISAppDataLocalTemppip-install-qanlzr18mysqlc
lient


PS: I've already installed the latest visual studio build tools (2017)










share|improve this question

























  • Installing mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl isn't going to work on Python 3.7 - as cp36 suggests in the filename, it's for Python 3.6. If you want to use mysqlconnector-python instead of Django, then you need to update the ENGINE in your DATABASES setting (docs).

    – Alasdair
    Jan 2 at 20:28













  • Are you running 32 bit Python? There is are wheels for the latest release 1.3.14, but they are only for Python 3.6 and 3.7 on 64-bit Windows. Perhaps you could [try re-installing] Python, but choose one of the x86-64 options.

    – Alasdair
    Jan 2 at 20:35













  • I tried installing a different version but I still end up getting the same error. I tried with python 3.7.1 32 bit and 64 bit. python 3.7.2 32 bit and 64 bit and also with python 2.7 32&64 bit.

    – Kaushal Sharma
    Jan 3 at 8:54













  • Giving a long list of things that didn’t work doesn’t gives us enough information to help you. Focus on one combination that should work (e.g. Python 3.7 (64 bit), and mysqlclient 1.3.14), show the exact commands you ran and the full error message.

    – Alasdair
    Jan 3 at 9:12














1












1








1








I've been trying to install mysqlclient for my python 3.7.2 for quite some time now.
Currently using windows 10, python 3.7.2 and wamp server 2.1



I tried using the following



1) pip install mysqlclient



2) pip install c:mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
and everything along those lines
Checked this link: Installing mysqlclient in Python 3.6 in windows



3)pip install "mysqlclient==1.3.12"



4) pip install --only-binary :all: mysqlclient



5)pip install mysql-connector-python



I tried doing all of the above using cmd (as administrator) and that failed as well.



Anyone with any sort of solution for this problem are welcome! Thank you in advance!



PS the connector installs but I still cant migrate.
It gives me the following error



Traceback (most recent call last):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 15, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 357, in execute
django.setup()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjango__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsregistry.py", line 112, in populate
app_config.import_models()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsconfig.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:UsersSOISPycharmProjectsBuggieIssuesmodels.py", line 8, in <module>
from django.contrib.auth.models import User, Group
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthmodels.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthbase_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 101, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 305, in add_to_class
value.contribute_to_class(cls, name)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsoptions.py", line 203, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodb__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?


And when i try to install mysqlclient:



  ----------------------------------------
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:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pi
p-install-qanlzr18\mysqlclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --reco
rd C:UsersSOISAppDataLocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating buildlib.win32-3.7
copying _mysql_exceptions.py -> buildlib.win32-3.7
creating buildlib.win32-3.7MySQLdb
copying MySQLdb__init__.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcompat.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconnections.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconverters.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcursors.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbrelease.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbtimes.py -> buildlib.win32-3.7MySQLdb
creating buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win32-3.7MySQLdbconstants
running build_ext
building '_mysql' extension
creating buildtemp.win32-3.7
creating buildtemp.win32-3.7Release
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023binHostX86x86cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,3,14,'final',0)
-D__version__=1.3.14 "-IC:Program Files (x86)MySQLMySQL Connector C 6.1include" -Ic:userssoisappdatalocalprogramspythonpython37-32include -Ic:userssoisappdatalocalprogra
mspythonpython37-32include "-IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023Include" "-IC:Program Files (x86)Microsoft Visual Studio2017
BuildToolsVCToolsMSVC14.16.27023ATLMFCInclude" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0
um" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0ucrt" "-IC:Program Files (x86)Windows KitsNET
FXSDK4.6.1includeum" /Tc_mysql.c /Fobuildtemp.win32-3.7Release_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:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe' failed with exit status 2

----------------------------------------
Command "c:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pip-install-qanlzr18\mysq
lclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersSOISAppData
LocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersSOISAppDataLocalTemppip-install-qanlzr18mysqlc
lient


PS: I've already installed the latest visual studio build tools (2017)










share|improve this question
















I've been trying to install mysqlclient for my python 3.7.2 for quite some time now.
Currently using windows 10, python 3.7.2 and wamp server 2.1



I tried using the following



1) pip install mysqlclient



2) pip install c:mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
and everything along those lines
Checked this link: Installing mysqlclient in Python 3.6 in windows



3)pip install "mysqlclient==1.3.12"



4) pip install --only-binary :all: mysqlclient



5)pip install mysql-connector-python



I tried doing all of the above using cmd (as administrator) and that failed as well.



Anyone with any sort of solution for this problem are welcome! Thank you in advance!



PS the connector installs but I still cant migrate.
It gives me the following error



Traceback (most recent call last):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 15, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocoremanagement__init__.py", line 357, in execute
django.setup()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjango__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsregistry.py", line 112, in populate
app_config.import_models()
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangoappsconfig.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:UsersSOISPycharmProjectsBuggieIssuesmodels.py", line 8, in <module>
from django.contrib.auth.models import User, Group
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthmodels.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangocontribauthbase_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 101, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsbase.py", line 305, in add_to_class
value.contribute_to_class(cls, name)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbmodelsoptions.py", line 203, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodb__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbutils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "C:UsersSOISAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:UsersSOISPycharmProjectsBuggievenvlibsite-packagesdjangodbbackendsmysqlbase.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?


And when i try to install mysqlclient:



  ----------------------------------------
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:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pi
p-install-qanlzr18\mysqlclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --reco
rd C:UsersSOISAppDataLocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating buildlib.win32-3.7
copying _mysql_exceptions.py -> buildlib.win32-3.7
creating buildlib.win32-3.7MySQLdb
copying MySQLdb__init__.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcompat.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconnections.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbconverters.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbcursors.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbrelease.py -> buildlib.win32-3.7MySQLdb
copying MySQLdbtimes.py -> buildlib.win32-3.7MySQLdb
creating buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win32-3.7MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win32-3.7MySQLdbconstants
running build_ext
building '_mysql' extension
creating buildtemp.win32-3.7
creating buildtemp.win32-3.7Release
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023binHostX86x86cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,3,14,'final',0)
-D__version__=1.3.14 "-IC:Program Files (x86)MySQLMySQL Connector C 6.1include" -Ic:userssoisappdatalocalprogramspythonpython37-32include -Ic:userssoisappdatalocalprogra
mspythonpython37-32include "-IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023Include" "-IC:Program Files (x86)Microsoft Visual Studio2017
BuildToolsVCToolsMSVC14.16.27023ATLMFCInclude" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0
um" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0ucrt" "-IC:Program Files (x86)Windows KitsNET
FXSDK4.6.1includeum" /Tc_mysql.c /Fobuildtemp.win32-3.7Release_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:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe' failed with exit status 2

----------------------------------------
Command "c:userssoisappdatalocalprogramspythonpython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\SOIS\AppData\Local\Temp\pip-install-qanlzr18\mysq
lclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersSOISAppData
LocalTemppip-record-uak3sgkfinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersSOISAppDataLocalTemppip-install-qanlzr18mysqlc
lient


PS: I've already installed the latest visual studio build tools (2017)







python mysql django python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 18:37







Kaushal Sharma

















asked Jan 2 at 18:31









Kaushal SharmaKaushal Sharma

467




467













  • Installing mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl isn't going to work on Python 3.7 - as cp36 suggests in the filename, it's for Python 3.6. If you want to use mysqlconnector-python instead of Django, then you need to update the ENGINE in your DATABASES setting (docs).

    – Alasdair
    Jan 2 at 20:28













  • Are you running 32 bit Python? There is are wheels for the latest release 1.3.14, but they are only for Python 3.6 and 3.7 on 64-bit Windows. Perhaps you could [try re-installing] Python, but choose one of the x86-64 options.

    – Alasdair
    Jan 2 at 20:35













  • I tried installing a different version but I still end up getting the same error. I tried with python 3.7.1 32 bit and 64 bit. python 3.7.2 32 bit and 64 bit and also with python 2.7 32&64 bit.

    – Kaushal Sharma
    Jan 3 at 8:54













  • Giving a long list of things that didn’t work doesn’t gives us enough information to help you. Focus on one combination that should work (e.g. Python 3.7 (64 bit), and mysqlclient 1.3.14), show the exact commands you ran and the full error message.

    – Alasdair
    Jan 3 at 9:12



















  • Installing mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl isn't going to work on Python 3.7 - as cp36 suggests in the filename, it's for Python 3.6. If you want to use mysqlconnector-python instead of Django, then you need to update the ENGINE in your DATABASES setting (docs).

    – Alasdair
    Jan 2 at 20:28













  • Are you running 32 bit Python? There is are wheels for the latest release 1.3.14, but they are only for Python 3.6 and 3.7 on 64-bit Windows. Perhaps you could [try re-installing] Python, but choose one of the x86-64 options.

    – Alasdair
    Jan 2 at 20:35













  • I tried installing a different version but I still end up getting the same error. I tried with python 3.7.1 32 bit and 64 bit. python 3.7.2 32 bit and 64 bit and also with python 2.7 32&64 bit.

    – Kaushal Sharma
    Jan 3 at 8:54













  • Giving a long list of things that didn’t work doesn’t gives us enough information to help you. Focus on one combination that should work (e.g. Python 3.7 (64 bit), and mysqlclient 1.3.14), show the exact commands you ran and the full error message.

    – Alasdair
    Jan 3 at 9:12

















Installing mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl isn't going to work on Python 3.7 - as cp36 suggests in the filename, it's for Python 3.6. If you want to use mysqlconnector-python instead of Django, then you need to update the ENGINE in your DATABASES setting (docs).

– Alasdair
Jan 2 at 20:28







Installing mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl isn't going to work on Python 3.7 - as cp36 suggests in the filename, it's for Python 3.6. If you want to use mysqlconnector-python instead of Django, then you need to update the ENGINE in your DATABASES setting (docs).

– Alasdair
Jan 2 at 20:28















Are you running 32 bit Python? There is are wheels for the latest release 1.3.14, but they are only for Python 3.6 and 3.7 on 64-bit Windows. Perhaps you could [try re-installing] Python, but choose one of the x86-64 options.

– Alasdair
Jan 2 at 20:35







Are you running 32 bit Python? There is are wheels for the latest release 1.3.14, but they are only for Python 3.6 and 3.7 on 64-bit Windows. Perhaps you could [try re-installing] Python, but choose one of the x86-64 options.

– Alasdair
Jan 2 at 20:35















I tried installing a different version but I still end up getting the same error. I tried with python 3.7.1 32 bit and 64 bit. python 3.7.2 32 bit and 64 bit and also with python 2.7 32&64 bit.

– Kaushal Sharma
Jan 3 at 8:54







I tried installing a different version but I still end up getting the same error. I tried with python 3.7.1 32 bit and 64 bit. python 3.7.2 32 bit and 64 bit and also with python 2.7 32&64 bit.

– Kaushal Sharma
Jan 3 at 8:54















Giving a long list of things that didn’t work doesn’t gives us enough information to help you. Focus on one combination that should work (e.g. Python 3.7 (64 bit), and mysqlclient 1.3.14), show the exact commands you ran and the full error message.

– Alasdair
Jan 3 at 9:12





Giving a long list of things that didn’t work doesn’t gives us enough information to help you. Focus on one combination that should work (e.g. Python 3.7 (64 bit), and mysqlclient 1.3.14), show the exact commands you ran and the full error message.

– Alasdair
Jan 3 at 9:12












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011408%2fcant-find-the-right-way-to-install-mysqlclient%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011408%2fcant-find-the-right-way-to-install-mysqlclient%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith