I have a new Macbook Pro M3 Pro and I am trying to install a Django project on it.
The pip install -r requirements.txt
command is returning error when trying to install mysqlclient python package. The error is the following:
Building wheel for mysqlclient (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [44 lines of output]
# Options for building extension module:
extra_compile_args: ['-I/opt/homebrew/opt/mysql-client/include', '-std=c99']
extra_link_args: ['-L/opt/hombrew/opt/mysql-client/lib']
define_macros: [('version_info', (2, 2, 4, 'final', 0)), ('__version__', '2.2.4')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.1-arm64-cpython-312
creating build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
copying src/MySQLdb/release.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
copying src/MySQLdb/cursors.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
copying src/MySQLdb/connections.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
copying src/MySQLdb/__init__.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
copying src/MySQLdb/times.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
copying src/MySQLdb/converters.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
copying src/MySQLdb/_exceptions.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb
creating build/lib.macosx-11.1-arm64-cpython-312/MySQLdb/constants
copying src/MySQLdb/constants/FLAG.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb/constants
copying src/MySQLdb/constants/CLIENT.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb/constants
copying src/MySQLdb/constants/__init__.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb/constants
copying src/MySQLdb/constants/ER.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb/constants
copying src/MySQLdb/constants/CR.py -> build/lib.macosx-11.1-arm64-cpython-312/MySQLdb/constants
copying src/MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-11.1-arm64-cpython-312/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-11.1-arm64-cpython-312/MySQLdb
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-11.1-arm64-cpython-312
creating build/temp.macosx-11.1-arm64-cpython-312/src
creating build/temp.macosx-11.1-arm64-cpython-312/src/MySQLdb
clang -fno-strict-overflow -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /opt/homebrew/anaconda3/envs/camimpeg/include -arch arm64 -fPIC -O2 -isystem /opt/homebrew/anaconda3/envs/camimpeg/include -arch arm64 -I/opt/homebrew/include "-Dversion_info=(2, 2, 4, 'final', 0)" -D__version__=2.2.4 -I/opt/homebrew/anaconda3/envs/camimpeg/include/python3.12 -c src/MySQLdb/_mysql.c -o build/temp.macosx-11.1-arm64-cpython-312/src/MySQLdb/_mysql.o -I/opt/homebrew/opt/mysql-client/include -std=c99
src/MySQLdb/_mysql.c:29:10: fatal error: 'mysql.h' file not found
#include "mysql.h"
^~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
In the requirements the version of the package is mysqlclient==2.1.1
and running the command pip install mysqlclient
is giving the same error.
I have already tried the brew install mysql-client pkg-config
command, also I have added to ~/.zshrc
file the variables:
MYSQLCLIENT_LDFLAGS="-L/opt/hombrew/opt/mysql-client/lib"
MYSQLCLIENT_CFLAGS="-I/opt/homebrew/opt/mysql-client/include"
PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig"
As seen in this question: Cannot install mysqlclient on MacOS with no good result.
Also I have installed mysql using the command brew install mysql
with the same result.
I am using anaconda3 installed through brew too and in the project I would use MAMP for mysql database process management.