I am trying to download pygame and am getting an error. I am on a mac computer on OS X 10.11.6. I have an updated version of pip and have Xcode already installed.The error comes up when I type in pip3 install pygame. The error is below...
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DENABLE_NEWBUF=1 -I/NEED_INC_PATH_FIX -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c src/scrap.c -o build/temp.macosx-10.6-intel-3.5/src/scrap.o
src/scrap.c:27:10: fatal error: 'SDL.h' file not found
#include "SDL.h"
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Most sites say to run this in terminal: xcode-select --install which will install xcode tools.
As for installing pygame with python3 on mac, it can be tricky sometimes, so if running the above in terminal stops that error but brings up another un-xcode-related one, I would suggest going here or here if that link fails.
Related
I'm trying to install Distance for python on my mac (OS X Yosemite).
After downloading the package and unpacking it, I run (as described on their page):
python setup.py install --with-c
From this I get the following error message:
running build_ext
building 'distance.cdistance' extension
gcc -fno-strict-aliasing -I/Users/me/anaconda/envs/name/include - arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/me/anaconda/envs/name/include/python2.7 -c cdistance/distance.c -o build/temp.macosx-10.5-x86_64-2.7/cdistance/distance.o
gcc -bundle -undefined dynamic_lookup -L/Users/me/anaconda/envs/name/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/cdistance/distance.o -L/Users/me/anaconda/envs/name/lib -o build/lib.macosx-10.5-x86_64-2.7/distance/cdistance.so
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
From what I understood from several posts like this one or this previously asked question, it looks like clang, which is called through the command gcc, can't find the libgcc library.
I ran find /usr/ -name libgcc*and this if what I get:
/usr//lib/libgcc_s.1.dylib
/usr//lib/libgcc_s.10.4.tbd
/usr//lib/libgcc_s.10.5.tbd
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/i386/libgcc.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/i386/libgcc_eh.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/libgcc.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/libgcc_eh.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_ext.10.4.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_ext.10.5.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_s.1.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_s_ppc64.1.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_s_x86_64.1.dylib
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/i386/libgcc.a
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/i386/libgcc_eh.a
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/libgcc.a
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/libgcc_eh.a
/usr//local/gfortran/lib/libgcc_ext.10.4.dylib
/usr//local/gfortran/lib/libgcc_ext.10.5.dylib
/usr//local/gfortran/lib/libgcc_s.1.dylib
/usr//local/gfortran/lib/libgcc_s_ppc64.1.dylib
/usr//local/gfortran/lib/libgcc_s_x86_64.1.dylib
And now I'm stuck because I don't know what to do next. Basically the question is: how do I make clang to know where the library is ?
I solved the issue thanks to this link which showed that this is a very recent issue with Xcode6.
You just need to upgrade Xcode to Xcode7 and set it up as your default toolkit chain. Easy.
I'm using Mac, and I am trying to write my own c code to use it from Python. I'm new to this, and trying out a sample example from http://www.tutorialspoint.com/python/python_further_extensions.htm.
But, when I run the setup.py file to install my c file, it gives me an error, and I'm not sure what to do. Below is the resulting error message. Thanks a lot!
$ sudo python3 setup.py install
Password:
running install
running build
running build_ext
building 'sample' extension
clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/sqlite/include -DFOO=1 -UBAR -I/some/dir -I/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c pysample.c -o build/temp.macosx-10.10-x86_64-3.4/pysample.o
clang -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.10-x86_64-3.4/pysample.o -L/usr/local/lib -lsample -o build/lib.macosx-10.10-x86_64-3.4/sample.so
ld: library not found for -lsample
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
I am having trouble installing gcc. Apparently I need gcc 4.0 in order to install a python package.
it gives the error of :
error: Command "gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc
-arch i386 -g -O2 -DNDEBUG -g -O3
-I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include
-Ibuild/src.macosx-10.3-fat-2.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 build/src.macosx-10.3-fat-2.7/src/_pycambmodule.c
-o build/temp.macosx-10.3-fat-2.7/build/src.macosx-10.3-fat-2.7/src/_pycambmodule.o"
failed with exit status 1
I have both gcc and gcc 4.0 in /usr/bin but I dont know why its not working.
It also gives the error gcc failed with exit status 1.
Any ideas would be appreciated.
Thanks
The command it's running says -arch ppc -arch i386 and I don't think that is valid for GCC 4.0 (it can't create an executable for both ppc and x86).
Are you sure you need GCC 4.0, not 4.0 or a later version? 4.0 is very old, so any package that doesn't work with newer versions of GCC is probably quite broken and unmaintained.
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.
I'm trying to install GDAL 1.7.1 on Mac OS X Lion using:
python setup.py build
python setup.py install
and get the error:
running build
running build_py
running build_ext
building 'osgeo._gdal' 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 -pipe -arch i386 -arch x86_64 -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Python/2.7/site-packages/numpy-2.0.0.dev_e2af7b7_20110721-py2.7-macosx-10.7-x86_64.egg/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/1.7/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-intel-2.7/extensions/gdal_wrap.o
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1
Is this the right compiler? How can I get this working?
UPDATE:
I get a little further with Xcode installed:
running build
running build_py
running build_ext
building 'osgeo._gdal' 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 -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Python/2.7/site-packages/numpy-2.0.0.dev_e2af7b7_20110721-py2.7-macosx-10.7-x86_64.egg/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/1.7/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-intel-2.7/extensions/gdal_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
extensions/gdal_wrap.cpp:2813:22: error: cpl_port.h: No such file or directory
extensions/gdal_wrap.cpp:2814:24: error: cpl_string.h: No such file or directory
extensions/gdal_wrap.cpp:2815:27: error: cpl_multiproc.h: No such file or directory
extensions/gdal_wrap.cpp:2817:18: error: gdal.h: No such file or directory
extensions/gdal_wrap.cpp:2818:23: error: gdal_priv.h: No such file or directory
extensions/gdal_wrap.cpp:2819:22: error: gdal_alg.h: No such file or directory
extensions/gdal_wrap.cpp:2820:24: error: gdalwarper.h: No such file or directory
extensions/gdal_wrap.cpp:2837: error: expected initializer before ‘VeryQuietErrorHandler’
extensions/gdal_wrap.cpp:2713: warning: ‘swig_module’ defined but not used
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
extensions/gdal_wrap.cpp:2813:22: error: cpl_port.h: No such file or directory
extensions/gdal_wrap.cpp:2814:24: error: cpl_string.h: No such file or directory
extensions/gdal_wrap.cpp:2815:27: error: cpl_multiproc.h: No such file or directory
extensions/gdal_wrap.cpp:2817:18: error: gdal.h: No such file or directory
extensions/gdal_wrap.cpp:2818:23: error: gdal_priv.h: No such file or directory
extensions/gdal_wrap.cpp:2819:22: error: gdal_alg.h: No such file or directory
extensions/gdal_wrap.cpp:2820:24: error: gdalwarper.h: No such file or directory
extensions/gdal_wrap.cpp:2837: error: expected initializer before ‘VeryQuietErrorHandler’
extensions/gdal_wrap.cpp:2713: warning: ‘swig_module’ defined but not used
lipo: can't open input file: /var/tmp//ccgnLEPX.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1
Homebrew works great for me. To install GDAL 1.9 with Homebrew all you have to do is
brew install gdal
Homebrew requires xcode, and I think commandline tools. More information can be found here
How about using the precompiled binaries available from http://www.kyngchaos.com/software/frameworks
Also, are you using 1.7.1 for a specific reason? 1.8.1 is, I believe, the current release build.
Caveat: I do not know if Lion is yet supported by the GDAL OSX binaries.
Did you actually install Xcode 4.1 on 10.7? Downloading it from the App Store is not enough; you have to manually run the Installer which it downloads to /Applications.
If you actually want to build from source, but want a convenient way to install there is a gdal package available from MacPorts - just install MacPorts, then on the command line type:
port install gdal
Macports will fetch and compile the source code for you. As of the time of writing the version in MacPorts is 1.9.0
for installing GDAL on mac:
brew install gdal
and then
pip install gdal
solved this for me