Python Forum
Web app with DB Crud can't pip install flask-mysqldb
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web app with DB Crud can't pip install flask-mysqldb
#1
Hello Python Community

I'm following a Tutorial for making a Python web app with a CRUD. It requires to install flask (Ok!) and flask-mysqldb(which throws the errors you can see below). It has never happened to me this, that a package can't be installed.

Error:
--------------------------------------------------------------------------------------------------------------------------------------------- PS C:\Users\PABLO\Desktop\sisclientes> pip install flask-mysqldb Collecting flask-mysqldb Using cached Flask_MySQLdb-2.0.0-py3-none-any.whl.metadata (3.0 kB) Requirement already satisfied: Flask>=1.0.4 in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from flask-mysqldb) (3.0.3) Collecting mysqlclient>=2.2.0 (from flask-mysqldb) Using cached mysqlclient-2.2.4.tar.gz (90 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: Werkzeug>=3.0.0 in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from Flask>=1.0.4->flask-mysqldb) (3.0.4) Requirement already satisfied: Jinja2>=3.1.2 in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from Flask>=1.0.4->flask-mysqldb) (3.1.4) Requirement already satisfied: itsdangerous>=2.1.2 in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from Flask>=1.0.4->flask-mysqldb) (2.2.0) Requirement already satisfied: click>=8.1.3 in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from Flask>=1.0.4->flask-mysqldb) (8.1.7) Requirement already satisfied: blinker>=1.6.2 in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from Flask>=1.0.4->flask-mysqldb) (1.8.2) Requirement already satisfied: colorama in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from click>=8.1.3->Flask>=1.0.4->flask-mysqldb) (0.4.6) Requirement already satisfied: MarkupSafe>=2.0 in c:\users\pablo\appdata\local\programs\python\python313\lib\site-packages (from Jinja2>=3.1.2->Flask>=1.0.4->flask-mysqldb) (3.0.1) Using cached Flask_MySQLdb-2.0.0-py3-none-any.whl (4.9 kB) 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 ╰─> [41 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, 4, 'final', 0)), ('__version__', '2.2.4')] running bdist_wheel running build running build_py creating build\lib.win-amd64-cpython-313\MySQLdb copying src\MySQLdb\connections.py -> build\lib.win-amd64-cpython-313\MySQLdb copying src\MySQLdb\converters.py -> build\lib.win-amd64-cpython-313\MySQLdb copying src\MySQLdb\cursors.py -> build\lib.win-amd64-cpython-313\MySQLdb copying src\MySQLdb\release.py -> build\lib.win-amd64-cpython-313\MySQLdb copying src\MySQLdb\times.py -> build\lib.win-amd64-cpython-313\MySQLdb copying src\MySQLdb\_exceptions.py -> build\lib.win-amd64-cpython-313\MySQLdb copying src\MySQLdb\__init__.py -> build\lib.win-amd64-cpython-313\MySQLdb creating build\lib.win-amd64-cpython-313\MySQLdb\constants copying src\MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-cpython-313\MySQLdb\constants copying src\MySQLdb\constants\CR.py -> build\lib.win-amd64-cpython-313\MySQLdb\constants copying src\MySQLdb\constants\ER.py -> build\lib.win-amd64-cpython-313\MySQLdb\constants copying src\MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-cpython-313\MySQLdb\constants copying src\MySQLdb\constants\FLAG.py -> build\lib.win-amd64-cpython-313\MySQLdb\constants copying src\MySQLdb\constants\__init__.py -> build\lib.win-amd64-cpython-313\MySQLdb\constants running egg_info writing src\mysqlclient.egg-info\PKG-INFO writing dependency_links to src\mysqlclient.egg-info\dependency_links.txt writing top-level names to src\mysqlclient.egg-info\top_level.txt reading manifest file 'src\mysqlclient.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' writing manifest file 'src\mysqlclient.egg-info\SOURCES.txt' copying src\MySQLdb\_mysql.c -> build\lib.win-amd64-cpython-313\MySQLdb running build_ext building 'MySQLdb._mysql' extension creating build\temp.win-amd64-cpython-313\Release\src\MySQLdb "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-Dversion_info=(2, 2, 4, 'final', 0)" -D__version__=2.2.4 -IC:/mariadb-connector\include\mariadb -IC:/mariadb-connector\include -IC:\Users\PABLO\AppData\Local\Programs\Python\Python313\include -IC:\Users\PABLO\AppData\Local\Programs\Python\Python313\" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/MySQLdb/_mysql.c /Fobuild\temp.win-amd64-cpython-313\Release\src/MySQLdb/_mysql.obj _mysql.c 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\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mysqlclient) PS C:\Users\PABLO\Desktop\sisclientes> pip uninstall flask-mysqldb WARNING: Skipping flask-mysqldb as it is not installed. PS C:\Users\PABLO\Desktop\sisclientes> ---------------------------------------------------------------------------------------------------------------------------------------------
Is there a way to solve this issue? Can anyone help me, please?
I will appreciate your help. Thank you!
Pablo
Reply
#2
This page may have something useful
https://stackoverflow.com/questions/5669...ysqlclient

Might think about using sqlite3
It's fairly easy to use.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts


Reply
#3
(Oct-16-2024, 09:25 PM)menator01 Wrote: This page may have something useful
https://stackoverflow.com/questions/5669...ysqlclient

Might think about using sqlite3
It's fairly easy to use.

Hello
The page gives replace for any OS excluding mine (Windows).
I have to use the package that is used in the Tutorial, if not it will not work.
Any other ideas?
Thanks
Reply
#4
Did you follow the instructions from here about installing dependencies? I like how it says the build is difficult for windows.
https://github.com/PyMySQL/mysqlclient#install

There is a lot of info here about installing the connector part.
https://pynative.com/install-mysql-connector-python/

And the installers from oracle.
https://dev.mysql.com/downloads/installer/

I would try the installer from the dev.mysql.com link to install mysql. After that try to install flask-mysqldb.
Reply
#5
(Oct-18-2024, 04:44 PM)deanhystad Wrote: Did you follow the instructions from here about installing dependencies? I like how it says the build is difficult for windows.
https://github.com/PyMySQL/mysqlclient#install

There is a lot of info here about installing the connector part.
https://pynative.com/install-mysql-connector-python/

And the installers from oracle.
https://dev.mysql.com/downloads/installer/

I would try the installer from the dev.mysql.com link to install mysql. After that try to install flask-mysqldb.

@deanhystad you solved my issue. Thank you very much!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CRUD in Update operation in Django Sowmya 2 1,338 Mar-19-2024, 04:14 AM
Last Post: Sowmya
  Error loading MySQLdb module. pythonsmurf 1 7,925 Feb-04-2021, 01:15 PM
Last Post: bishwasbh
  CRUD performing but output not shown in table format in flask lunchcook 2 5,103 Oct-23-2018, 03:42 PM
Last Post: lunchcook
  Failing to install Flask on Windows using pip shayon 1 3,518 Jul-11-2018, 12:36 AM
Last Post: micseydel
  How to install flask boostrap? Peter_EU 3 15,771 Oct-22-2017, 05:09 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020