Skip to content

pip3 install mysqlclient fails on mysql version >= 8.3.0 #687

@AvishekDe

Description

@AvishekDe

Discussed in #686

Originally posted by AvishekDe January 29, 2024

What OS and which version do you use?

macOS 14.3

How did you installed mysql client library?

brew install mysql

Output from pkg-config --cflags --libs mysqlclient

-I/opt/homebrew/Cellar/mysql-client/8.3.0/include/mysql -L/opt/homebrew/Cellar/mysql-client/8.3.0/lib -lmysqlclient

How did you tried to install mysqlclient?

pip install mysqlclient

Output of building mysqlclient

Collecting mysqlclient
  Using cached mysqlclient-2.2.1.tar.gz (89 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
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
  ╰─> [58 lines of output]
      # Options for building extension module:
        extra_compile_args: ['-I/opt/homebrew/Cellar/mysql-client/8.3.0/include/mysql', '-std=c99']
        extra_link_args: ['-L/opt/homebrew/Cellar/mysql-client/8.3.0/lib', '-lmysqlclient']
        define_macros: [('version_info', (2, 2, 1, 'final', 0)), ('__version__', '2.2.1')]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-14.1-arm64-cpython-311
      creating build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      copying src/MySQLdb/release.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      copying src/MySQLdb/cursors.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      copying src/MySQLdb/connections.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      copying src/MySQLdb/__init__.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      copying src/MySQLdb/times.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      copying src/MySQLdb/converters.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      copying src/MySQLdb/_exceptions.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb
      creating build/lib.macosx-14.1-arm64-cpython-311/MySQLdb/constants
      copying src/MySQLdb/constants/FLAG.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb/constants
      copying src/MySQLdb/constants/CLIENT.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb/constants
      copying src/MySQLdb/constants/__init__.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb/constants
      copying src/MySQLdb/constants/ER.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb/constants
      copying src/MySQLdb/constants/CR.py -> build/lib.macosx-14.1-arm64-cpython-311/MySQLdb/constants
      copying src/MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-14.1-arm64-cpython-311/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.macosx-14.1-arm64-cpython-311/MySQLdb
      running build_ext
      building 'MySQLdb._mysql' extension
      creating build/temp.macosx-14.1-arm64-cpython-311
      creating build/temp.macosx-14.1-arm64-cpython-311/src
      creating build/temp.macosx-14.1-arm64-cpython-311/src/MySQLdb
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/opt/homebrew/opt/mysql-client/include "-Dversion_info=(2, 2, 1, 'final', 0)" -D__version__=2.2.1 -I/Users/avishekde/.pyenv/versions/3.11.6/include/python3.11 -c src/MySQLdb/_mysql.c -o build/temp.macosx-14.1-arm64-cpython-311/src/MySQLdb/_mysql.o -I/opt/homebrew/Cellar/mysql-client/8.3.0/include/mysql -std=c99
      src/MySQLdb/_mysql.c:527:9: error: call to undeclared function 'mysql_ssl_set'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
              mysql_ssl_set(&(self->connection), key, cert, ca, capath, cipher);
              ^
      src/MySQLdb/_mysql.c:527:9: note: did you mean 'mysql_close'?
      /opt/homebrew/Cellar/mysql-client/8.3.0/include/mysql/mysql.h:797:14: note: 'mysql_close' declared here
      void STDCALL mysql_close(MYSQL *sock);
                   ^
      src/MySQLdb/_mysql.c:1795:9: error: call to undeclared function 'mysql_kill'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          r = mysql_kill(&(self->connection), pid);
              ^
      src/MySQLdb/_mysql.c:1795:9: note: did you mean 'mysql_ping'?
      /opt/homebrew/Cellar/mysql-client/8.3.0/include/mysql/mysql.h:525:13: note: 'mysql_ping' declared here
      int STDCALL mysql_ping(MYSQL *mysql);
                  ^
      src/MySQLdb/_mysql.c:2011:9: error: call to undeclared function 'mysql_shutdown'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          r = mysql_shutdown(&(self->connection), SHUTDOWN_DEFAULT);
              ^
      3 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions