Cannot install python package confluent-kafka on Mac Sierra - python

Spent too much time attempting to install confluent-kafka with no luck. I understand there is a librdkafka dependency, but that appears to have installed successfully.
Tried following advice from:
http://docs.confluent.io/3.1.1/installation.html#cpp-client
https://github.com/confluentinc/confluent-kafka-python/issues/6
https://github.com/confluentinc/confluent-kafka-go/issues/39
Results
MyMac1234567:~ joe.user$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.3
BuildVersion: 16D32
MyMac1234567:~ joe.user$ brew install openssl
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from bb3e509 to 7e5b2fb.
Updated 1 tap (homebrew/core).
==> Updated Formulae
kafka
Warning: openssl is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
MyMac1234567:~ joe.user$ brew install librdkafka
==> Using the sandbox
==> Downloading https://github.com/edenhill/librdkafka/archive/0.9.1.tar.gz
Already downloaded: /Users/jeff.graham/Library/Caches/Homebrew/librdkafka-0.9.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/librdkafka/0.9.1
==> make
==> make install
🍺 /usr/local/Cellar/librdkafka/0.9.1: 14 files, 1.3MB, built in 11 seconds
MyMac1234567:~ joe.user$ python -V
Python 2.7.10
MyMac1234567:~ joe.user$ pip -V
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
MyMac1234567:~ joe.user$ sudo -H pip install confluent-kafka
Collecting confluent-kafka
Using cached confluent-kafka-0.9.4.tar.gz
Installing collected packages: confluent-kafka
Running setup.py install for confluent-kafka ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-VbLtMr/confluent-kafka/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-iPYPmz-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka
copying confluent_kafka/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro
copying confluent_kafka/avro/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro
copying confluent_kafka/avro/cached_schema_registry_client.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_client.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_consumer.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_producer.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro/serializer
copying confluent_kafka/avro/serializer/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro/serializer
copying confluent_kafka/avro/serializer/message_serializer.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro/serializer
running build_ext
building 'confluent_kafka.cimpl' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/confluent_kafka
creating build/temp.macosx-10.12-intel-2.7/confluent_kafka/src
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 confluent_kafka/src/confluent_kafka.c -o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/confluent_kafka.o
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 confluent_kafka/src/Producer.c -o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Producer.o
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 confluent_kafka/src/Consumer.c -o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Consumer.o
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/confluent_kafka.o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Producer.o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Consumer.o -lrdkafka -o build/lib.macosx-10.12-intel-2.7/confluent_kafka/cimpl.so
ld: warning: ignoring file /usr/local/lib/librdkafka.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/librdkafka.dylib
running install_lib
copying build/lib.macosx-10.12-intel-2.7/confluent_kafka/cimpl.so -> /Library/Python/2.7/site-packages/confluent_kafka
running install_data
copying LICENSE -> /System/Library/Frameworks/Python.framework/Versions/2.7/
error: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/LICENSE'
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-VbLtMr/confluent-kafka/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-iPYPmz-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-VbLtMr/confluent-kafka/

Since El Capitan 10.11, Apple has created a System Integrity Protection(SIP) that does not even allow a super user to change anything in these folders: /System, /bin, /sbin, or /usr (except /usr /local).
Pre requiremets form MacOS El Capitan or newer:
brew install pkg-config
brew upgrade openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
Because of this, I need clone and compile librdkafka by my own, and changed the prefix fom /usr to /usr/local
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --clean
./configure --prefix /usr/local
make
sudo make install

Sorry, many things I was doing wrong:
brew doctor
**brew doctor found symlink issues:**
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
freetds
brew link --overwrite --dry-run freetds
Reinstalled librdkafka
brew uninstall librdkafka
brew install librdkafka
Most importantly, found I was following old/outdated/dangerous practice of sudo for pip per here.
https://github.com/ipython/ipython/issues/9523
Used --user instead and we're good.
pip install confluent-kafka --user
Collecting confluent-kafka
Using cached confluent-kafka-0.9.4.tar.gz
Installing collected packages: confluent-kafka
Running setup.py install for confluent-kafka ... done
Successfully installed confluent-kafka-0.9.4
Sorry for posting an issue prematurely. Hopefully this will help someone out.

Related

can't install reportlab mac OS X 10.9.2 + python2.7

I'm struggling to install reportlab on mac OS X 10.9.2 with python 2.7. I managed to install it using pip3 even if I need it for python2.7 so I believe I have all the required packages installed.
Can you please help?
Here is the install log (If you need the full unstripped log, just ask):
$>pip install reportlab
Downloading/unpacking reportlab
Downloading reportlab-3.0.tar.gz (1.9MB): 1.9MB downloaded
Running setup.py egg_info for package reportlab
################################################
#Attempting install of _rl_accel & pyHnj
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel'
################################################
################################################
#Attempting install of _renderPM
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/renderPM'
will use package libart 2.3.12
# installing with freetype version 21
################################################
Downloading standard T1 font curves
Finished download of standard T1 font curves
()
########## SUMMARY INFO #########
################################################
#Attempting install of _rl_accel & pyHnj
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel'
################################################
################################################
#Attempting install of _renderPM
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/renderPM'
will use package libart 2.3.12
# installing with freetype version 21
################################################
Downloading standard T1 font curves
Finished download of standard T1 font curves
Installing collected packages: reportlab
Running setup.py install for reportlab
################################################
#Attempting install of _rl_accel & pyHnj
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel'
################################################
################################################
#Attempting install of _renderPM
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/renderPM'
will use package libart 2.3.12
# installing with freetype version 21
################################################
Standard T1 font curves already downloaded
building 'reportlab.lib._rl_accel' 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 /private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel/_rl_accel.c -o build/temp.macosx-10.9-intel-2.7/private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel/_rl_accel.o
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
Complete output from command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip_build_root/reportlab/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xduBeA-record/install-record.txt --single-version-externally-managed:
################################################
#Attempting install of _rl_accel & pyHnj
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel'
################################################
################################################
#Attempting install of _renderPM
#extensions from '/private/tmp/pip_build_root/reportlab/src/rl_addons/renderPM'
will use package libart 2.3.12
# installing with freetype version 21
################################################
Standard T1 font curves already downloaded
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-intel-2.7
creating build/lib.macosx-10.9-intel-2.7/reportlab
copying src/reportlab/__init__.py -> build/lib.macosx-10.9-intel-2.7/reportlab
copying src/reportlab/rl_config.py -> build/lib.macosx-10.9-intel-2.7/reportlab
[...] -> lots of copying/creating lines stripped here for more clarity
running build_ext
creating build/temp.macosx-10.9-intel-2.7/private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel
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 /private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel/_rl_accel.c -o build/temp.macosx-10.9-intel-2.7/private/tmp/pip_build_root/reportlab/src/rl_addons/rl_accel/_rl_accel.o
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
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip_build_root/reportlab/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ty1Jj1-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/tmp/pip_build_root/reportlab
Storing complete log in /Users/hugo/Library/Logs/pip.log
Just found out the solution here.
Just add these env settings prior to compilation to tell clang to ignore the error.
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Hopefully will help someone!

Unable to install MySQL-Python Mac Mavericks

I am unable to install MySQL-Python on Mavericks with sudo pip install MySQL-Python
I did
export CPPFLAGS=-Qunused-arguments
and
export CFLAGS=-Qunused-arguments before running the command, but I still ran into this same error.
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.9-intel-2.7
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 -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.6.15/include/mysql -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
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
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip-build-root/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_UV3aF-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/tmp/pip-build-root/mysql-python
Run the following before pip install...
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Ok, here's what I did:
sudo CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments python setup.py build
then same thing, but 'install' instead of build

Installation Scrapy Error on Mac 10.9.1 using pip

I'm trying to install scrapy on mac os 10.9.1
sudo pip install scrapy
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/usr/include/libxml2 -I/private/var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip_build_tommy/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.9-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
xcrun: error: active developer path ("/Developer") does not exist, use xcode-select to change
error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip_build_tommy/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip-BlN0gM-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip_build_tommy/lxml
Storing debug log for failure in /Users/tommy/Library/Logs/pip.log
I also tried pip install scrapy without sudo, also failed with the same error.
I checked the similar issue on S.O, and found this
I followed the solution there
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11
No such file or directory.
I'm new to Mac os. could you give some suggestions? or another convenient way to install scrapy?
I used anaconda before, but it doesn't have scrapy incorporated. And I heard there's a package manager called homebrew..but I have no idea how to use it.
Thanks a lot!
Did you see the update to the answer you linked?
Try this in your terminal:
xcode-select --install
I tried to update my Xcode, and installed the xcode command line.
then installed homebrew, reinstalled the python, and pip install scrapy. It turns out totally OK.
So if you have such problems, and you don't have much knowledge about mac, try to follow the steps: check the version of your Xcode, and using homebrew to get pip, and then it would be OK.

Difficulty installing PIL on OS X Lion 10.7.4 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
The problem with installing PIL using virtualenv or buildout
how to install PIL on mac os x 10.7.2 Lion
I'm trying to install the latest version of PIL (1.1.7) on Mac OS X Lion (10.7.4). I generally just use PIP and the following command:
sudo pip install package_name
However, I'm getting an error message for PIL, as it is refusing to cooperate with me.
Here is what I received:
mac-cordreys-macbook-pro:~ maccordrey$ sudo pip install PIL
Password:
Downloading/unpacking PIL
Downloading PIL-1.1.7.tar.gz (506Kb): 506Kb downloaded
Running setup.py egg_info for package PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
Installing collected packages: PIL
Running setup.py install for PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
llvm-gcc-4.2 -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 -arch i386 -arch x86_64 -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.7-intel-2.7/_imaging.o
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/maccordrey/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-KmYgGQ-record/install-record.txt:
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-intel-2.7
copying PIL/__init__.py -> build/lib.macosx-10.7-intel-2.7
(To save space I've redacted this middle portion, but it's just more copying of package scripts.)
copying PIL/XVThumbImagePlugin.py -> build/lib.macosx-10.7-intel-2.7
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
creating build/temp.macosx-10.7-intel-2.7
creating build/temp.macosx-10.7-intel-2.7/libImaging
llvm-gcc-4.2 -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 -arch i386 -arch x86_64 -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.7-intel-2.7/_imaging.o
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/Users/maccordrey/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-KmYgGQ-record/install-record.txt failed with error code 1 in /Users/maccordrey/build/PIL
Storing complete log in /Users/maccordrey/Library/Logs/pip.log
Any advice would be appreciated! Thank you!
I should also note that when trying to install Pillow as an alternative I received the exact same error message.

how to install psycopg2 on OSX 10.7

I followed the following procedure:
1) $ sudo pip install psycopg2
This gave me the following error
Downloading/unpacking psycopg2
Running setup.py egg_info for package psycopg2
no previously-included directories found matching 'doc/src/_build'
Installing collected packages: psycopg2
Running setup.py install for psycopg2
building 'psycopg2._psycopg' extension
llvm-gcc-4.2 -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 -arch i386 -arch x86_64 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.3 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.7-intel-2.7/psycopg/psycopgmodule.o
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/boltellinfomedia/mukul/mukul/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8NaS72-record/install-record.txt:
running install
running build
running build_py
running build_ext
building 'psycopg2._psycopg' extension
llvm-gcc-4.2 -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 -arch i386 -arch x86_64 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.3 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.7-intel-2.7/psycopg/psycopgmodule.o
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/Users/boltellinfomedia/mukul/mukul/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8NaS72-record/install-record.txt failed with error code 1
Storing complete log in /Users/boltellinfomedia/.pip/pip.log
2) Then I searched on web for installing llvm-gcc-4.2 and from this http://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-llvm-gcc/_index.html
got to know that I need to install Xcode
Also from this psycopg2 installation problem on OSX Lion I came to know that I can install psycopg2 via macports but then from this http://www.macports.org/install.php came to know that I need xcode again.
3) Finally I tried to install Xcode from apple store, it downloaded 1.6 gb file and after that says that it is now installed on my system. Here is the screenshot of the same
![macports installed image][1]
4) And then I tried to install macports via the dmg file available at http://www.macports.org/install.php but it says that xcode not yet installed on my system. Here is the screenshot of the same. ![when trying to install macport, xcode not installed message appears][2]
There is an additional detail missing here. In Xcode 4.3 and higher you need to install the command-line tools as a separate step. You need to do this in order for the script to initiate the call to the command line version of llvm-gcc-4.2
Go to Xcode > Preferences > Downloads > Command Line Tools Install.
The problem most likely is that you only downloaded the Xcode INSTALLER from the App Store. You now need to run the installer to install Xcode.

Categories

Resources