ERROR: Failed building wheel for mysqlclient Failed to build mysqlclient >Win10-Flask-V.S. Code<

232 Views Asked by At

I'm unable to get the 'flask run --debug' command to work in my virtual environment in VS Code. It initially prompted me to install 'flask-mysqldb', and after running the 'pip install flask-mysqldb' command, it begins downloading until it is interrupted, giving me the following message:

Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (pyproject.toml) ... error
  error: subprocess-exited-with-error

 ** × Building wheel for mysqlclient (pyproject.toml) did not run successfully.
  │ exit code: 1**
  ╰─> [46 lines of output]
      # Options for building extension module:
        library_dirs: ['C:/mariadb-connector\\lib\\mariadb', 'C:/mariadb-connector\\lib']
        libraries: ['kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', 'crypt32', 'secur32', 'bcrypt', 'mariadbclient']
        extra_link_args: ['/MANIFEST']
        include_dirs: ['C:/mariadb-connector\\include\\mariadb', 'C:/mariadb-connector\\include']
        extra_objects: []
        define_macros: [('version_info', (2, 2, 0, 'final', 0)), ('__version__', '2.2.0')]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\MySQLdb
      copying src\MySQLdb\connections.py -> build\lib.win-amd64-cpython-312\MySQLdb
      ...
      src/MySQLdb/_mysql.c(29): fatal error C1083: No se puede abrir el archivo incluir: 'mysql.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
**  ERROR: Failed building wheel for mysqlclient
Failed to build mysqlclient
ERROR: Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects.**

I would like to know how to proceed. I have already tried with ChatGPT, and the solutions it suggested did not resolve this dilemma for me.

1

There are 1 best solutions below

0
nbk On

try it over and over again, till the download is complete.

Explaination:

The server stops at different times sending data and you get your error.

pip can not resume downloads, so that it tries to download the whole package over again.

And you need to try it till the download is completed.

Update: There is already a discussions on github https://github.com/pypa/pip/issues/4796