skip to Main Content

I ran cmd.exe, as administrator, in my PC. Then typed: pip install mariadb, but this is the output it displayed:

Collecting mariadb
  Using cached mariadb-1.1.10.tar.gz (84 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting packaging (from mariadb)
  Using cached packaging-24.0-py3-none-any.whl.metadata (3.2 kB)
Using cached packaging-24.0-py3-none-any.whl (53 kB)
Building wheels for collected packages: mariadb
  Building wheel for mariadb (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for mariadb (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      using environment configuration C:pathtomariadb-connector-c
      Found MariaDB Connector/C in 'C:pathtomariadb-connector-c'
      running bdist_wheel
      running build
      running build_py
      creating build
      creating buildlib.win-amd64-cpython-313
      creating buildlib.win-amd64-cpython-313mariadb
      copying mariadb__init__.py -> buildlib.win-amd64-cpython-313mariadb
      copying mariadbconnectionpool.py -> buildlib.win-amd64-cpython-313mariadb
      copying mariadbconnections.py -> buildlib.win-amd64-cpython-313mariadb
      creating buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstants__init__.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsCAPABILITY.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsCLIENT.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsCURSOR.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsERR.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsFIELD_FLAG.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsFIELD_TYPE.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsEXT_FIELD_TYPE.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsINDICATOR.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsINFO.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsSTATUS.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbconstantsTPC_STATE.py -> buildlib.win-amd64-cpython-313mariadbconstants
      copying mariadbcursors.py -> buildlib.win-amd64-cpython-313mariadb
      copying mariadbdbapi20.py -> buildlib.win-amd64-cpython-313mariadb
      copying mariadbfield.py -> buildlib.win-amd64-cpython-313mariadb
      copying mariadbrelease_info.py -> buildlib.win-amd64-cpython-313mariadb
      running build_ext
      building 'mariadb._mariadb' extension
      creating buildtemp.win-amd64-cpython-313
      creating buildtemp.win-amd64-cpython-313Release
      creating buildtemp.win-amd64-cpython-313Releasemariadb
      "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.39.33519binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=10 -DPY_MARIADB_PRE_RELEASE_SEGMENT="None" -DPY_MARIADB_PRE_RELEASE_NR="0" -DPY_MARIADB_POST_RELEASE_SEGMENT="None" -DPY_MARIADB_POST_RELEASE_NR="0" -I.include -IC:pathtomariadb-connector-cinclude -IC:pathtomariadb-connector-cincludemysql -IC:Python313include -IC:Python313Include "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.39.33519include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22621.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\cppwinrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" /Tcmariadb/mariadb.c /Fobuildtemp.win-amd64-cpython-313Releasemariadb/mariadb.obj /MD
      mariadb.c
      .includemariadb_python.h(27): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
      error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\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 mariadb
Failed to build mariadb
ERROR: Could not build wheels for mariadb, which is required to install pyproject.toml-based projects

Why is this happening?

I updated my Visual C++ to the latest version, and my python version is 3.13, and pip is version 24.0 from C:Python313Libsite-packagespip.

Can someone please help me with this?

2

Answers


  1. You may be missing the MariaDB Connector/C libraries and header files. Head to the official download site and install everything listed in the prerequisites tab.

    https://mariadb-corporation.github.io/mariadb-connector-python/install.html#build-prerequisites?

    Then u should be good to go!

    Login or Signup to reply.
  2. You’re trying to install MariaDB Connector/C with Python 3.13 alpha (stable version expected in October 2024).

    Pypi.org provides MariaDB Connector/C wheel packages for all non eoled stable versions, but not for development versions. For these versions it is required to install prerequisite MariaDB Connector/C. .

    The error is raised, since you specified the environment variable MARIADB_CC_INSTALL_DIR (points to C:pathtomariadb-connector-c), but MariaDB Connector/C is not installed in this directory.

    If MariaDB Connector/C was installed via MSI, MariaDB Connector/Python will automatically find it – if you installed it manually, then the preferred way is to change the path in site.cfg file.

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