skip to Main Content
pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.1.1.tar.gz (88 kB)
  Preparing metadata (setup.py) .. done
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) .. error
  ERROR: Command errored out with exit status 1:
   command: 'c:usershpappdatalocalprogramspythonpython36python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppD
ata\Local\Temp\pip-install-mmb7531p\mysqlclient_a141c7c0a933439fbe19807e877c7cc2\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install
-mmb7531p\mysqlclient_a141c7c0a933439fbe19807e877c7cc2\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.St
ringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'
))' bdist_wheel -d 'C:UsersHPAppDataLocalTemppip-wheel-44gqcvbi'
       cwd: C:UsersHPAppDataLocalTemppip-install-mmb7531pmysqlclient_a141c7c0a933439fbe19807e877c7cc2
  Complete output (25 lines):
  c:usershpappdatalocalprogramspythonpython36libdistutilsdist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating buildlib.win-amd64-3.6
  creating buildlib.win-amd64-3.6MySQLdb
  copying MySQLdb__init__.py -> buildlib.win-amd64-3.6MySQLdb
  copying MySQLdb_exceptions.py -> buildlib.win-amd64-3.6MySQLdb
  copying MySQLdbconnections.py -> buildlib.win-amd64-3.6MySQLdb
  copying MySQLdbconverters.py -> buildlib.win-amd64-3.6MySQLdb
  copying MySQLdbcursors.py -> buildlib.win-amd64-3.6MySQLdb
  copying MySQLdbrelease.py -> buildlib.win-amd64-3.6MySQLdb
  copying MySQLdbtimes.py -> buildlib.win-amd64-3.6MySQLdb
  creating buildlib.win-amd64-3.6MySQLdbconstants
  copying MySQLdbconstants__init__.py -> buildlib.win-amd64-3.6MySQLdbconstants
  copying MySQLdbconstantsCLIENT.py -> buildlib.win-amd64-3.6MySQLdbconstants
  copying MySQLdbconstantsCR.py -> buildlib.win-amd64-3.6MySQLdbconstants
  copying MySQLdbconstantsER.py -> buildlib.win-amd64-3.6MySQLdbconstants
  copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win-amd64-3.6MySQLdbconstants
  copying MySQLdbconstantsFLAG.py -> buildlib.win-amd64-3.6MySQLdbconstants
  running build_ext
  building 'MySQLdb._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
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
    Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:usershpappdatalocalprogramspythonpython36python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\Ap
pData\Local\Temp\pip-install-mmb7531p\mysqlclient_a141c7c0a933439fbe19807e877c7cc2\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-insta
ll-mmb7531p\mysqlclient_a141c7c0a933439fbe19807e877c7cc2\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.
StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'
"'))' install --record 'C:UsersHPAppDataLocalTemppip-record-ylfwp41xinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:
usershpappdatalocalprogramspythonpython36Includemysqlclient'
         cwd: C:UsersHPAppDataLocalTemppip-install-mmb7531pmysqlclient_a141c7c0a933439fbe19807e877c7cc2
    Complete output (25 lines):
    c:usershpappdatalocalprogramspythonpython36libdistutilsdist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'        
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating buildlib.win-amd64-3.6
    creating buildlib.win-amd64-3.6MySQLdb
    copying MySQLdb__init__.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdb_exceptions.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbconnections.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbconverters.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbcursors.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbrelease.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbtimes.py -> buildlib.win-amd64-3.6MySQLdb
    creating buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstants__init__.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsCLIENT.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsCR.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsER.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsFLAG.py -> buildlib.win-amd64-3.6MySQLdbconstants
    running build_ext
    building 'MySQLdb._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        
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:usershpappdatalocalprogramspythonpython36python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys
.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-mmb7531p\mysqlclient_a141c7c0a933439fbe19807e877c7cc2\setup.py'"'"'; __file__='"'"'C:\Users\HP
\AppData\Local\Temp\pip-install-mmb7531p\mysqlclient_a141c7c0a933439fbe19807e877c7cc2\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if 
os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(com
pile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersHPAppDataLocalTemppip-record-ylfwp41xinstall-record.txt' --single-version-externally-managed
 --compile --install-headers 'c:usershpappdatalocalprogramspythonpython36Includemysqlclient' Check the logs for full command output.

I’am trying to install mysqlclient in Pycharm. But i couldn’t,its showing me these errors.There are errors while buliding wheel for mysqlclient. Django version is 3.2.18. Pip version is 21.3.1. Does this error happens due to mismatch of versions of pip and mysqlclient? ………………………………………………………………………………………………

3

Answers


  1. Chosen as BEST ANSWER

    I updated my python version 3.8, the problem solved.


  2. why don’t use the MSI setup file to install it. it’s okay with pip, I will check what is the problem, but for the time being go here & install: https://dev.mysql.com/downloads/installer/

    MySQL client installs the full suite in your machine (including the CLI). You said about PyCharm, it is going to use the CLI. So just install the full suite setup.

    See, I just did this,

    PS C:UsersArchisman> pip install mysqlclient
    Collecting mysqlclient
      Downloading mysqlclient-2.1.1-cp310-cp310-win_amd64.whl (178 kB)
         ---------------------------------------- 178.4/178.4 kB 10.5 MB/s eta 0:00:00
    Installing collected packages: mysqlclient
    Successfully installed mysqlclient-2.1.1
    
    [notice] A new release of pip available: 22.3.1 -> 23.0.1
    [notice] To update, run: C:UsersArchismanAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0python.exe -m pip install --upgrade pip
    PS C:UsersArchisman>
    

    I had installed MySQL through the setup file & works everywhere. So, just download the setup & install it. pip install mysqlclient may leave some of the packages to be installed & that’s causing the error.

    Also don’t forget that MySQL needs MS Visual Studio Build Tools. So, it’s better run the setup.

    UPDATE
    Found this in your Shell:

    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
    

    Just what I guessed.

    Login or Signup to reply.
  3. As the error messages indicate, The problem could be the "Microsoft Visual C++ Build Tools". So try installing that depandency.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search