When I try to build PIL on Mac OS X 10.8.1 Mountain Lion, I get the following result:
$ sudo python setup.py install
Password:
running install
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' 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 -arch i386 -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -IlibImaging -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.8-intel-2.7/_imaging.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
_imaging.c:75:10: fatal error: 'Python.h' file not found
#include "Python.h"
^
1 error generated.
error: command 'clang' failed with exit status 1
PIL does not keep up with support for new operating systems (by making changes to setup.py for new lib dirs, etc). But intstead of PIL, you can use the "friendly PIL fork" Pillow:
http://pypi.python.org/pypi/Pillow
And if you get the same error, please report the issue:
https://github.com/python-imaging/Pillow/issues/new
From this SO question, I was able to find Python.h in /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7. (note that i have Xcode installed)
I then ran sudo python setup.py build_ext --include-dirs /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7:/Developer/SDKs/MacOSX10.7.sdk/usr/include
(note: /Developer/SDKs/MacOSX10.7.sdk/usr/include added because stdio.h was missing once the Python.h was resolved)
Finally, I ran sudo python setup.py install
Related
I am trying to download mlpy using the instructions from the website, however I keep encoutnering the error of 'gsl/gsl_sf.h' file not found. The following code is generated, any help will be appreciated:
$ python setup.py install
running install
running build
running build_py
running build_ext
skipping 'mlpy/gsl/gsl.c' Cython extension (up-to-date)
building 'mlpy.gsl' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mlpy/gsl/gsl.c -o build/temp.macosx-10.6-intel-2.7/mlpy/gsl/gsl.o
mlpy/gsl/gsl.c:223:10: fatal error: 'gsl/gsl_sf.h' file not found
#include "gsl/gsl_sf.h"
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
The same error being generated when using the header line:
$ python setup.py build_ext --include-dirs=/path/to/header --rpath=/path/to/lib
running build_ext
skipping 'mlpy/gsl/gsl.c' Cython extension (up-to-date)
building 'mlpy.gsl' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/path/to/header -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mlpy/gsl/gsl.c -o build/temp.macosx-10.6-intel-2.7/mlpy/gsl/gsl.o
mlpy/gsl/gsl.c:223:10: fatal error: 'gsl/gsl_sf.h' file not found
#include "gsl/gsl_sf.h"
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
****EDIT****
Seems like there was an issue with Xcode, after updating Xcode mlpy was imported correctly
Good day to everyone,
I've an error trying to compile and install Pygraphviz 1.2 in OS X 10.9
I've downloaded the pygraphviz archive from https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.2.zip#md5=90c728a8db276eede4e3af2f990a8985
From Terminal I've typed
sudo ./setup.py install
the output was:
Trying pkg-config
library_path=/usr/local/Cellar/graphviz/2.38.0/lib
include_path=/usr/local/Cellar/graphviz/2.38.0/include/graphviz
running install
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' 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/usr/local/Cellar/graphviz/2.38.0/include/graphviz -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.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
As you can see I've already installed graphviz with Homebrew.
The error is in clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
Solution from clang error: unknown argument: '-mno-fused-madd' (python package installation failure) is:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
I am attempting to install pycurl-7.19.0 on my Mac OSX 10.8.4.
The error I get when compiling:
py setup.py install
The results:
Using curl-config (libcurl 7.24.0)
running install
running build
running build_py
running build_ext
building 'pycurl' 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 -arch i386 -arch x86_64 -pipe -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/pycurl.c -o build/temp.macosx-10.8-intel-2.7/src/pycurl.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
In file included from src/pycurl.c:50:
In file included from /usr/local/include/curl/curl.h:35:
/usr/local/include/curl/curlrules.h:143:6: error: '__curl_rule_01__' declared as an array with a negative size
[CurlchkszEQ(long, CURL_SIZEOF_LONG)];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/curl/curlrules.h:132:27: note: expanded from macro 'CurlchkszEQ'
#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/curl/curlrules.h:153:6: error: '__curl_rule_02__' declared as an array with a negative size
[CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/curl/curlrules.h:132:27: note: expanded from macro 'CurlchkszEQ'
#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
^~~~~~~~~~~~~~~~~~~~~~~
src/pycurl.c:85:4: warning: "libcurl was compiled with SSL support, but configure could not determine which " "library
was used; thus no SSL crypto locking callbacks will be set, which may " "cause random crashes on SSL requests"
[-W#warnings]
# warning \
^
1 warning and 2 errors generated.
error: command 'clang' failed with exit status 1
I currently have curl-7.32.0 installed and am running Python 2.7.2 and GCC 4.2.1.
This works for me on OSX 10.9
sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl==7.19.0
Question about Python's setuptools. I just did a fresh install of Mac OS 10.8 and installed the official Python 2.7.3 package. When installing the binary module py-bcrypt (or any other binary module for that matter), I get the following error:
bcrypt/bcrypt_python.c:17:10: fatal error: 'Python.h' file not found
#include "Python.h"
^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1
Running sudo easy_install --verbose py-bcrypt shows the following call to CLang:
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 -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bcrypt/bcrypt_python.c -o build/temp.macosx-10.8-intel-2.7/bcrypt/bcrypt_python.o
...which is fine except for this part:
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
Because Python.h is actually stored in the non-System Library here: /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h
So to finally get to the point: How do you change the default include path used by setuptools?
In Ubuntu, doing this in .bashrc or .zshrc would solve the issue:
export C_INCLUDE_PATH=/you_name_it/include/python2.7
export CPLUS_INCLUDE_PATH=/you_name_it/include/python2.7
It enabled gcc to find other headers you need, but I'm not sure whether it works for clang.
I still have no idea how to actually do this, but I found a workaround. Installing XCode's Command Line Tools (Preferences -> Download -> Command Line Tools) put Python headers in the right place.
I'am trying to install libspotify on Mac OSX Lion. I want to use spotify api in a Python script. When I try installing pyspotify, it says:
running install
running bdist_egg
running egg_info
writing pyspotify.egg-info/PKG-INFO
writing top-level names to pyspotify.egg-info/top_level.txt
writing dependency_links to pyspotify.egg-info/dependency_links.txt
reading manifest file 'pyspotify.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyspotify.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.8-intel/egg
running install_lib
running build_py
running build_ext
building 'spotify._spotify' 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 -arch i386 -arch x86_64 -pipe -Isrc -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/module.c -o build/temp.macosx-10.8-intel-2.7/src/module.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
src/module.c:20:10: fatal error: 'spotify/api.h' file not found
#include "spotify/api.h"
^
1 error generated.
error: command 'clang' failed with exit status 1
I tried to install libspotify using brew...
brew install libspotify
Either you install it with brew, as you say, or just copy the libspotify.framework to /Library/Frameworks
Now you should be able to include the lib like:
#include <libspotify/api.h>