New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not install mysqlclient-python in python3 on mac #175

Closed
tingxin opened this Issue Jun 5, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@tingxin

tingxin commented Jun 5, 2017

Hi All,
I follow the readme.md file and follow those steps to install mysqlclient:

  1. create a new virtualenv
  2. use python3.5
  3. brew install mysql-connector-c
  4. sudo pip3 install mysqlclient or sudo pip install mysqlclient

i got the error like this:
`
Using cached mysqlclient-1.3.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/private/tmp/pip-build-th5nbtoa/mysqlclient/setup.py", line 17, in
metadata, options = get_config()
File "/private/tmp/pip-build-th5nbtoa/mysqlclient/setup_posix.py", line 54, in get_config
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/tmp/pip-build-th5nbtoa/mysqlclient/setup_posix.py", line 54, in
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/tmp/pip-build-th5nbtoa/mysqlclient/setup_posix.py", line 12, in dequote
if s[0] in ""'" and s[0] == s[-1]:
IndexError: string index out of range

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-th5nbtoa/mysqlclient/
`

@methane

This comment has been minimized.

Show comment
Hide comment
@methane

methane Jun 5, 2017

Member

Why don't you search recent issues before filing new one?
#169
#170
#171

Member

methane commented Jun 5, 2017

Why don't you search recent issues before filing new one?
#169
#170
#171

@methane methane closed this Jun 5, 2017

@dariabiryukova

This comment has been minimized.

Show comment
Hide comment
@dariabiryukova

dariabiryukova Sep 8, 2017

I've got the same problem. What have been done it's just adding :/usr/local/mysql/bin the $PATH

dariabiryukova commented Sep 8, 2017

I've got the same problem. What have been done it's just adding :/usr/local/mysql/bin the $PATH

@IrisYGL

This comment has been minimized.

Show comment
Hide comment
@IrisYGL

IrisYGL Oct 12, 2017

Hi,All
I had the following problems:

i) modify file: /usr/local/bin/mysql_config (which mysql_config)
origin:

Create options libs="-L$pkglibdir" libs="$libs -l "

modified to

Create options libs="-L$pkglibdir" libs="$libs -lmysqlclient -lssl -lcrypto"

ii)add environment veriables(brew info openssl)
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
iii)pip3 install mysqlclient

problem as below:

Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /Users/yuguanglin/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/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 /var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/tmp8tr14eqmpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
copying mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
running build_ext
building 'mysql' extension
creating build/temp.macosx-10.9-x86_64-3.6
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/usr/local/opt/openssl/include -Dversion_info=(1,3,12,'final',0) -D__version
=1.3.12 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Users/yuguanglin/anaconda3/include/python3.6m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.6/_mysql.o
/usr/bin/clang -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include -arch x86_64 build/temp.macosx-10.9-x86_64-3.6/_mysql.o -L/Users/yuguanglin/anaconda3/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.6/_mysql.cpython-36m-darwin.so $ libs
clang: error: no such file or directory: '$'
clang: error: no such file or directory: 'libs'
error: command '/usr/bin/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
Running setup.py install for mysqlclient ... error
Complete output from command /Users/yuguanglin/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/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 /var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-cgt6e4dt-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
copying mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
running build_ext
building 'mysql' extension
creating build/temp.macosx-10.9-x86_64-3.6
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/usr/local/opt/openssl/include -Dversion_info=(1,3,12,'final',0) -D__version
=1.3.12 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Users/yuguanglin/anaconda3/include/python3.6m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.6/_mysql.o
/usr/bin/clang -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include -arch x86_64 build/temp.macosx-10.9-x86_64-3.6/_mysql.o -L/Users/yuguanglin/anaconda3/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.6/_mysql.cpython-36m-darwin.so $ libs
clang: error: no such file or directory: '$'
clang: error: no such file or directory: 'libs'
error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------

Command "/Users/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/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 /var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-cgt6e4dt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/mysqlclient/

@methane

IrisYGL commented Oct 12, 2017

Hi,All
I had the following problems:

i) modify file: /usr/local/bin/mysql_config (which mysql_config)
origin:

Create options libs="-L$pkglibdir" libs="$libs -l "

modified to

Create options libs="-L$pkglibdir" libs="$libs -lmysqlclient -lssl -lcrypto"

ii)add environment veriables(brew info openssl)
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
iii)pip3 install mysqlclient

problem as below:

Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /Users/yuguanglin/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/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 /var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/tmp8tr14eqmpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
copying mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
running build_ext
building 'mysql' extension
creating build/temp.macosx-10.9-x86_64-3.6
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/usr/local/opt/openssl/include -Dversion_info=(1,3,12,'final',0) -D__version
=1.3.12 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Users/yuguanglin/anaconda3/include/python3.6m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.6/_mysql.o
/usr/bin/clang -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include -arch x86_64 build/temp.macosx-10.9-x86_64-3.6/_mysql.o -L/Users/yuguanglin/anaconda3/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.6/_mysql.cpython-36m-darwin.so $ libs
clang: error: no such file or directory: '$'
clang: error: no such file or directory: 'libs'
error: command '/usr/bin/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
Running setup.py install for mysqlclient ... error
Complete output from command /Users/yuguanglin/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/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 /var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-cgt6e4dt-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
copying mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
running build_ext
building 'mysql' extension
creating build/temp.macosx-10.9-x86_64-3.6
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/usr/local/opt/openssl/include -Dversion_info=(1,3,12,'final',0) -D__version
=1.3.12 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Users/yuguanglin/anaconda3/include/python3.6m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.6/_mysql.o
/usr/bin/clang -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/yuguanglin/anaconda3/lib -L/Users/yuguanglin/anaconda3/lib -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include -arch x86_64 build/temp.macosx-10.9-x86_64-3.6/_mysql.o -L/Users/yuguanglin/anaconda3/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.6/_mysql.cpython-36m-darwin.so $ libs
clang: error: no such file or directory: '$'
clang: error: no such file or directory: 'libs'
error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------

Command "/Users/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/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 /var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-cgt6e4dt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/ml/xgv9v8gn6kl2l4yj3xmtyxnc0000gn/T/pip-build-z961_iww/mysqlclient/

@methane

@methane

This comment has been minimized.

Show comment
Hide comment
@methane

methane Oct 12, 2017

Member

I'm not user support. Go stackoverflow.

Member

methane commented Oct 12, 2017

I'm not user support. Go stackoverflow.

@PyMySQL PyMySQL locked and limited conversation to collaborators Oct 12, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.