Configuring MySQL with python on OS X lion - python

MySQL is installed at /usr/local/mysql
In site.cfg the path for mysql_config is /usr/local/mysql/bin/mysql_config
but when i try to build in the terminal im getting this error:
hammads-imac-2:MySQL-python-1.2.4b4 syedhammad$ sudo python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb
running build_ext
building '_mysql' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'beta',4) -D_version_=1.2.4b4 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.8-intel-2.7/_mysql.o -Wno-null-conversion -Os -g -fno-strict-aliasing -arch x86_64
unable to execute clang: No such file or directory
error: command 'clang' failed with exit status 1
Help Please

You probably need Xcode's Command Line Tools.
Download the lastest version of Xcode, then go to "Preferences", select "Download" tab, then install Command Line Tools.

Related

Can't install jupyter (Python 3.9.0, macos 11)

I installed Miniforge3-MacOSX-arm64, and tried to pip install --upgrade pip.
But it shows same error message.
The install package command is pip install jupyter.
Building wheels for collected packages: argon2-cffi
Building wheel for argon2-cffi (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /Users/dong/miniforge3/bin/python3.9 /Users/dong/miniforge3/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/k3/97_hcf414hdflf7snt870zlc0000gn/T/tmp7zue7y84
cwd: /private/var/folders/k3/97_hcf414hdflf7snt870zlc0000gn/T/pip-install-fvo3ra87/argon2-cffi_43f8dcc2cf894b4bb48b05d5556d0c5d
Complete output (29 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.0-arm64-3.9
creating build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/__init__.py -> build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/low_level.py -> build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/_ffi_build.py -> build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/_password_hasher.py -> build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/exceptions.py -> build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/_legacy.py -> build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/__main__.py -> build/lib.macosx-11.0-arm64-3.9/argon2
copying src/argon2/_utils.py -> build/lib.macosx-11.0-arm64-3.9/argon2
running build_clib
building 'argon2' library
creating build/temp.macosx-11.0-arm64-3.9
creating build/temp.macosx-11.0-arm64-3.9/extras
creating build/temp.macosx-11.0-arm64-3.9/extras/libargon2
creating build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src
creating build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/blake2
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/argon2.c -o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/argon2.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/blake2/blake2b.c -o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/blake2/blake2b.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/core.c -o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/core.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/encoding.c -o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/encoding.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/ref.c -o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/ref.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/dong/miniforge3/include -arch arm64 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/thread.c -o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/thread.o
/Users/runner/miniforge3/conda-bld/python-split_1608587737618/_build_env/bin/llvm-ar rcs build/temp.macosx-11.0-arm64-3.9/libargon2.a build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/argon2.o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/blake2/blake2b.o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/core.o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/encoding.o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/ref.o build/temp.macosx-11.0-arm64-3.9/extras/libargon2/src/thread.o
error: command '/Users/runner/miniforge3/conda-bld/python-split_1608587737618/_build_env/bin/llvm-ar' failed: No such file or directory
----------------------------------------
ERROR: Failed building wheel for argon2-cffi
Failed to build argon2-cffi
ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
Tried many times, but it is still such an error.
Try this, might help
pip install jupyter notebook
Check also here.
I never used Mac, might the proper way is pip install notebook
I would rather suggest to use Python 3.8.X, I think it is too early for 3.9.X, let them fix smth or because it is not yet supported, I need to check that. I usually move to next Python after 3-6 months only.

./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found

I was trying to install zbar on my Macbook.
When I execute command pip install zbar (after brew install zbar) Exception is thrown as below:
Collecting zbar
Using cached zbar-0.10.tar.bz2
Installing collected packages: zbar
Running setup.py install for zbar
building 'zbar' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.11-intel-2.7/zbarmodule.o
In file included from zbarmodule.c:24:
./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
#include <zbar.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-build-PlQauK/zbar/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-0yRA4D-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'zbar' extension
creating build
creating build/temp.macosx-10.11-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.11-intel-2.7/zbarmodule.o
In file included from zbarmodule.c:24:
./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
#include <zbar.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-build-PlQauK/zbar/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-0yRA4D-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-build-PlQauK/zbar
There is a similar question, However the answers are not helpful in my case.
I also tried another way to install according to this link
However the same error occurred when I type python setup.py install
running install
running build
running build_ext
building 'zbar' extension
creating build
creating build/temp.macosx-10.11-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.11-intel-2.7/zbarmodule.o
In file included from zbarmodule.c:24:
./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
#include <zbar.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
I had the same problem, and I run conda install zbar, after that, the error disappeared.

Python: Xcode no longer allows pip install mysql-python. Workaround Needed

I'm having major issues this morning trying to install mysql-python connector on the Mac.
The issues is down to a recent update to xcode 5.1:
http://bruteforce.gr/installing-mitmproxy-os-x-maverics-bypassing-clang-error-unknown-argument.html
http://forums.getpebble.com/discussion/11862/installation-error-perhaps-due-to-xcode-5-1
However, I have tried the current work-around and I still get the error:
This is what I have tried:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future sudo pip install mysql-python
This is the error:
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
Anyone had the same issue and know of a workaround that works in your virtual env?
I wrote the post on your first link. I am not 100% percent sure but I think the problem lies with the use of sudo. The variable is set under your user, while the pip command is elevated to root privileges, i.e. is executed under another user. Try to do the above logged in as root user from the start, without sudoing.

Simplejson on mac os x 10.9 Mavericks

I've been spending a day in order to install simplejson package. Always I'm without success!
When I type :
pip install simplejson
It raised me error :
Installing collected packages: simplejson
Running setup.py install for simplejson
building 'simplejson._speedups' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c simplejson/_speedups.c -o build/temp.macosx-10.9-intel-2.7/simplejson/_speedups.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
Has some one ever met error like this, or can give me advice what i can do in order to install it?
So we managed to fix the problem on the chat. It was problem related to upgrading to OS X mavericks and this article was really helpful http://attentionshard.wordpress.com/2013/10/25/os-x-mavericks-fixing-broken-python-development-environments/.

Can't run mongod command after got pymongo installed from pip

I'm running a virtualenv on osx 10.7.4, and I was trying to install MongoDB for python, which is version 2.7.3.
I just installed it from pip, and am trying to see what happens if I run mongod command, but it turns out I can't run the command.
Below is what happened in my terminal, could anyone give a hand here about what could be wrong?
(test1)Dus-MacBook-Air:~ mepine$ pip install pymongo
Downloading/unpacking pymongo
Downloading pymongo-2.2.1.tar.gz (230Kb): 230Kb downloaded
Running setup.py egg_info for package pymongo
Installing collected packages: pymongo
Running setup.py install for pymongo
building 'bson._cbson' extension
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibson -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c bson/_cbsonmodule.c -o build/temp.macosx-10.4-x86_64-2.7/bson/_cbsonmodule.o
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibson -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c bson/time64.c -o build/temp.macosx-10.4-x86_64-2.7/bson/time64.o
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibson -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c bson/buffer.c -o build/temp.macosx-10.4-x86_64-2.7/bson/buffer.o
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibson -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c bson/encoding_helpers.c -o build/temp.macosx-10.4-x86_64-2.7/bson/encoding_helpers.o
/usr/bin/clang -bundle -undefined dynamic_lookup -L/usr/local/Cellar/readline/6.2.2/lib build/temp.macosx-10.4-x86_64-2.7/bson/_cbsonmodule.o build/temp.macosx-10.4-x86_64-2.7/bson/time64.o build/temp.macosx-10.4-x86_64-2.7/bson/buffer.o build/temp.macosx-10.4-x86_64-2.7/bson/encoding_helpers.o -o build/lib.macosx-10.4-x86_64-2.7/bson/_cbson.so
building 'pymongo._cmessage' extension
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibson -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c pymongo/_cmessagemodule.c -o build/temp.macosx-10.4-x86_64-2.7/pymongo/_cmessagemodule.o
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibson -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c bson/buffer.c -o build/temp.macosx-10.4-x86_64-2.7/bson/buffer.o
/usr/bin/clang -bundle -undefined dynamic_lookup -L/usr/local/Cellar/readline/6.2.2/lib build/temp.macosx-10.4-x86_64-2.7/pymongo/_cmessagemodule.o build/temp.macosx-10.4-x86_64-2.7/bson/buffer.o -o build/lib.macosx-10.4-x86_64-2.7/pymongo/_cmessage.so
Successfully installed pymongo
Cleaning up...
(test1)Dus-MacBook-Air:~ mepine$ mongod
-bash: mongod: command not found
Thanks guys!!
I think maybe you're confusing the python mongo driver with the mongo server itself.
Did you install mongodb (mongod, mongo, etc.), or just pymongo?
There's a homebrew package for mongodb, just in case you want an easy way to install it--or you can download it directly from http://www.mongodb.org/downloads.

Categories

Resources