Cant complete mysql-python installation in OSX - python

I have tried to get this to work, but I have had no success. I'm trying to install mysql-python by running :
pip install mysql-python
but I always get this error
clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1
I have used homebrew to update all libraries and I have already installed mysql. I also made sure to have the latest pip, xcode and xcode command line tools.
I have searched for hours but I have not found a way get this package to build.
Please, if anyone has run into a similar situation, I would greatly appreciate a little bit of guidance.
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
Running setup.py bdist_wheel for mysql-python ... error
Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/pip-build-lCuswO/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/tmpFVHSn1pip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.11-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.7.12/include/mysql -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.11-x86_64-2.7/_mysql.o -fno-omit-frame-pointer
clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1

This might be because x-code is not installed
xcode-select --install

You should install MySQL through Homebrew first, to get python-mysql work properly on OS X.
pip uninstall MySQL-python
brew install mysql
brew install mysql-connector-c
pip install MySQL-python
Original answer : MySQL-python on mac

Related

Please inform Django connecting to mysql for M1mac [duplicate]

This question already has an answer here:
Error on "pip install -U channels" command using for otree (Running setup.py bdist_wheel for twisted ... error)
(1 answer)
Closed 3 months ago.
I want to connect django to mysql. So I tried pip install mysqlclient, but I get the following error.
[running environment]
machin: M1 Mac
OS ventura
mysql8.0.30: installed by brew
[trying note]
installing Cmake : not solve
Please let me know the latest solution for M1 Mac.
[erro logs]
$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [41 lines of output]
mysql_config --version
['8.0.30']
mysql_config --libs
['-L/opt/homebrew/Cellar/mysql/8.0.30/lib', '-lmysqlclient', '-lz', '-L/opt/homebrew/lib', '-lzstd', '-L/opt/homebrew/opt/openssl#1.1/lib', '-lssl', '-lcrypto', '-lresolv']
mysql_config --cflags
['-I/opt/homebrew/Cellar/mysql/8.0.30/include/mysql']
ext_options:
library_dirs: ['/opt/homebrew/Cellar/mysql/8.0.30/lib', '/opt/homebrew/lib', '/opt/homebrew/opt/openssl#1.1/lib']
libraries: ['mysqlclient', 'resolv']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/opt/homebrew/Cellar/mysql/8.0.30/include/mysql']
extra_objects: []
define_macros: [('version_info', "(2,1,1,'final',0)"), ('__version__', '2.1.1')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-39
creating build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
creating build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.9-x86_64-cpython-39
creating build/temp.macosx-10.9-x86_64-cpython-39/MySQLdb
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/anaconda3/envs/django/include -arch x86_64 -I/opt/anaconda3/envs/django/include -fPIC -O2 -isystem /opt/anaconda3/envs/django/include -arch x86_64 -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/opt/homebrew/Cellar/mysql/8.0.30/include/mysql -I/opt/anaconda3/envs/django/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-cpython-39/MySQLdb/_mysql.o -std=c99
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
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
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
error: subprocess-exited-with-error
× Running setup.py install for mysqlclient did not run successfully.
│ exit code: 1
╰─> [43 lines of output]
mysql_config --version
['8.0.30']
mysql_config --libs
['-L/opt/homebrew/Cellar/mysql/8.0.30/lib', '-lmysqlclient', '-lz', '-L/opt/homebrew/lib', '-lzstd', '-L/opt/homebrew/opt/openssl#1.1/lib', '-lssl', '-lcrypto', '-lresolv']
mysql_config --cflags
['-I/opt/homebrew/Cellar/mysql/8.0.30/include/mysql']
ext_options:
library_dirs: ['/opt/homebrew/Cellar/mysql/8.0.30/lib', '/opt/homebrew/lib', '/opt/homebrew/opt/openssl#1.1/lib']
libraries: ['mysqlclient', 'resolv']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/opt/homebrew/Cellar/mysql/8.0.30/include/mysql']
extra_objects: []
define_macros: [('version_info', "(2,1,1,'final',0)"), ('__version__', '2.1.1')]
running install
/opt/anaconda3/envs/django/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-39
creating build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb
creating build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-cpython-39/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.9-x86_64-cpython-39
creating build/temp.macosx-10.9-x86_64-cpython-39/MySQLdb
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/anaconda3/envs/django/include -arch x86_64 -I/opt/anaconda3/envs/django/include -fPIC -O2 -isystem /opt/anaconda3/envs/django/include -arch x86_64 -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/opt/homebrew/Cellar/mysql/8.0.30/include/mysql -I/opt/anaconda3/envs/django/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-cpython-39/MySQLdb/_mysql.o -std=c99
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
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: legacy-install-failure
× Encountered error while trying to install package.
╰─> mysqlclient
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Use:
pip install wheel
pip install --upgrade setuptools

Cant install mysqlclient on MacOS

I am trying to run my windows created python script on MacOS.
I have managed to install all of the needed modules apart from MySQLdb.
I am trying to install from pip3 using this command:
pip3 install mysqlclient
But get a massive error:
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-wheel-md6mses2 --python-tag cp37
cwd: /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/
Complete output (30 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/MySQLdb
xcrun -sdk macosx clang -arch x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Headers -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o
xcrun -sdk macosx clang -arch x86_64 -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'xcrun' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-record-zi37f1af/install-record.txt --single-version-externally-managed --compile
cwd: /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/MySQLdb
xcrun -sdk macosx clang -arch x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Headers -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o
xcrun -sdk macosx clang -arch x86_64 -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'xcrun' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-record-zi37f1af/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
I have tried multiple forum posts that I have found and nothing is working. I have also tried to build from Source but I get an error about ConfigParser not being installed - which it has been via pip.
Please could someone help?!
P.S Pip has been updated to the latest version.
try this:
brew install mysql
or
https://github.com/PyMySQL/mysqlclient-python/issues/169

unable pip install mysqlclient & execute 'gcc': Permission denied

Forgive me if I ask something really simple
I am setting up a Django app on a remote server, by Namecheap (no root access)
and my server information:
Apache Version: 2.4.38
MySQL Version: 10.1.38-MariaDB-cll-lve
Architecture: x86_64
Operating System: linux
Python: 3.7
Django: 2.1.7
Now I'm trying to had mysql DB connect to my django app.
But when I try installing connector mysqlclient with pip install mysqlclient
I had this error:
$ pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /home/letsilap/virtualenv/IOT/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_19o3wdf/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp45bylejwpip-wheel- --python-tag cp37:
/opt/alt/python37/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
gcc -pthread -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python37/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'gcc': Permission denied
error: command 'gcc' failed with exit status 1
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /home/letsilap/virtualenv/IOT/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_19o3wdf/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-v39up5s1-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/letsilap/virtualenv/IOT/3.7/include/site/python3.7/mysqlclient:
/opt/alt/python37/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
gcc -pthread -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python37/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'gcc': Permission denied
error: command 'gcc' failed with exit status 1
Command "/home/letsilap/virtualenv/IOT/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_19o3wdf/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-v39up5s1-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/letsilap/virtualenv/IOT/3.7/include/site/python3.7/mysqlclient" failed with error code 1 in /tmp/pip-build-_19o3wdf/mysqlclient/
I dive into an error message,(understand)
unable to execute 'gcc': Permission denied
error: command 'gcc' failed with exit status 1
it seem to show that error lies on permission of luinx system
Does anyone know how to solve this issue? highly, apprenticed
unable to execute 'gcc': Permission denied
means your user does not have permission to run the gcc C compiler.
This is pretty unusual, and it sounds like a (slightly ham-fisted) security measure on the server you're using. You will need to ask whoever administers the server for assistance.
you must have root permission to run these type of commands usually. add sudo to your command:
sudo pip install mysqlclient

Cannot install mysqlclient in a virtualenv

I have a virtualenv named dev and I am trying to install the required dependencies. During that, I am getting the following error at mysqlclient when I am trying to install using pip install -r requirements.txt which has the requirements:
This is the Error Log for the command which I am running:
Collecting slack-log-handler==0.2.2 (from -r requirements.txt (line 16))
Collecting SQLAlchemy==1.0.15 (from -r requirements.txt (line 17))
Requirement already satisfied: Werkzeug==0.11.11 in /Users/bharathv/Desktop/Work/Customer_API/dev/lib/python2.7/site-packages (from -r requirements.txt (line 18)) (0.11.11)
Collecting pendulum==2.0.4 (from -r requirements.txt (line 19))
Collecting typing<4.0,>=3.6; python_version < "3.5" (from pendulum==2.0.4->-r requirements.txt (line 19))
Using cached https://files.pythonhosted.org/packages/cc/3e/29f92b7aeda5b078c86d14f550bf85cff809042e3429ace7af6193c3bc9f/typing-3.6.6-py2-none-any.whl
Collecting pytzdata>=2018.3 (from pendulum==2.0.4->-r requirements.txt (line 19))
Using cached https://files.pythonhosted.org/packages/89/02/a3a1cef5074c28157df63846d05aa893f007a92f6bafec0d61cae36bf69d/pytzdata-2018.9-py2.py3-none-any.whl
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
Complete output from command /Users/bharathv/Desktop/Work/Customer_API/dev/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dc/dqq29fh52nq9nppk0rd0kdg40000gp/T/pip-install-pemYYE/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/dc/dqq29fh52nq9nppk0rd0kdg40000gp/T/pip-wheel-P7vfx2 --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-x86_64-2.7
creating build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/usr/local/Cellar/mysql/8.0.15/include/mysql -I/usr/local/Cellar/python#2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-x86_64-2.7/_mysql.o
_mysql.c:29:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient, Flask-MySQLdb, pytz, Flask-RESTful, mysql, requests, slack-log-handler, SQLAlchemy, typing, pytzdata, pendulum
Running setup.py install for mysqlclient ... error
Complete output from command /Users/bharathv/Desktop/Work/Customer_API/dev/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dc/dqq29fh52nq9nppk0rd0kdg40000gp/T/pip-install-pemYYE/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/dc/dqq29fh52nq9nppk0rd0kdg40000gp/T/pip-record-y_LFeb/install-record.txt --single-version-externally-managed --compile --install-headers /Users/bharathv/Desktop/Work/Customer_API/dev/bin/../include/site/python2.7/mysqlclient:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-x86_64-2.7
creating build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/usr/local/Cellar/mysql/8.0.15/include/mysql -I/usr/local/Cellar/python#2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-x86_64-2.7/_mysql.o
_mysql.c:29:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/bharathv/Desktop/Work/Customer_API/dev/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dc/dqq29fh52nq9nppk0rd0kdg40000gp/T/pip-install-pemYYE/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/dc/dqq29fh52nq9nppk0rd0kdg40000gp/T/pip-record-y_LFeb/install-record.txt --single-version-externally-managed --compile --install-headers /Users/bharathv/Desktop/Work/Customer_API/dev/bin/../include/site/python2.7/mysqlclient" failed with error code 1 in /private/var/folders/dc/dqq29fh52nq9nppk0rd0kdg40000gp/T/pip-install-pemYYE/mysqlclient/
Any help would be greatly appreciated.
Regards,
Bharath
MySQLdb package is a wrapper of mysql C API. so it depends on OS package. and it is out of virtualenv scope.
so you need to install proper mysql package from your os package manager.
or you can avoid this error by using pure python connector like pymysql

Using MariaDB with Django 1.10 and Python 3.5

I want to migrate my database from SQLite to MariaDB. Running Ubuntu 14.04, Django 1.10 and Python 3.5. Digital Ocean has a guide, but it silently assumes one is using Python 2.x, not 3.x. They use the default mySQL connector, MySQLdb. This does not work for python 3.x. According to Django docs, the preferred alternative is mysqlsclient:
pip install mysqlclient
But this gives:
Collecting mysqlclient
Using cached mysqlclient-1.3.9.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp39x31avopip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.5/MySQLdb
creating build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,9,'final',1) -D__version__=1.3.9 -I/usr/include/mysql -I/usr/include/python3.5m -I/django/env/include/python3.5m -c _mysql.c -o build/temp.linux-x86_64-3.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qfim2s5n-record/install-record.txt --single-version-externally-managed --compile --install-headers /django/env/include/site/python3.5/mysqlclient:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.5/MySQLdb
creating build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,9,'final',1) -D__version__=1.3.9 -I/usr/include/mysql -I/usr/include/python3.5m -I/django/env/include/python3.5m -c _mysql.c -o build/temp.linux-x86_64-3.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qfim2s5n-record/install-record.txt --single-version-externally-managed --compile --install-headers /django/env/include/site/python3.5/mysqlclient" failed with error code 1 in /tmp/pip-build-3_5btd8o/mysqlclient/
Not sure why it's partially duplicated.
According to this question, the solution to such x86_64-linux-gnu-gcc errors is to install:
sudo apt install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
which I did, but this made no difference.
Then I tried a bunch of other stuff, including:
sudo apt-get install libmysqlclient-dev python-dev
Which gave:
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.52-0ubuntu0.14.04.1) but 5.5.52+maria-1~trusty is to be installed
E: Unable to correct problems, you have held broken packages.
I found an answer where it was said that aptitude is more useful than apt-get and that one can see a list of held packages with:
dpkg --get-selections | grep hold
But nothing is returned when running this. Trying aptitude gives:
(env) user#computer:/$ sudo aptitude install libmysqlclient-dev
The following NEW packages will be installed:
libmysqlclient-dev{b}
0 packages upgraded, 1 newly installed, 0 to remove and 179 not upgraded.
Need to get 0 B/866 kB of archives. After unpacking 5,604 kB will be used.
The following packages have unmet dependencies:
libmariadbclient-dev : Conflicts: libmysqlclient-dev but 5.5.52-0ubuntu0.14.04.1 is to be installed.
Conflicts: libmysqlclient15-dev which is a virtual package.
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.52-0ubuntu0.14.04.1) but 5.5.52+maria-1~trusty is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libmysqlclient-dev [Not Installed]
It looks like a conflict between mysql and mariaDB based packages. So I found:
pip install libmariadbclient-dev
Which installs fine, but the error is still there when trying to install mysqlclient.
How do I get MariaDB to work with Django 1.10 and Python 3.5?
I ran into the same issue while i was executing
pip install mysqlclient
Then i found out i had to install python3-dev packages, but they were resolving into python3.6 and i was using python3.4 in my virtualenv.
All i had to do was:
sudo apt-get install python3.4-dev

Categories

Resources