I followed these steps to install the GEOS libraries (source ). I successfully installed the GEOS library. My problem is in the following step:
cd back to the top level basemap directory (basemap-X.Y.Z) and
run the usual 'python setup.py install'. Check your installation
by running "from mpl_toolkits.basemap import Basemap" at the python
prompt.
When I run the setup.py file I get the following error:
distutils.errors.CompileError: Command "gcc-4.2 -fno-strict-aliasing -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Isrc -c nad2bin.c -o nad2bin.o" failed with exit status 127
Im working with a Mac with OS version 10.9.2.
I have installed the gcc compiler through the command line tools package in Xcode.
My gcc compiler info:
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
Related
I am trying to install the pynbody package for python.
I run pip3 install pynbody, but the command fails.
It says:
ERROR: Could not build wheels for pynbody which use PEP 517 and cannot be installed directly
Before it gives the error:
error: Command "/usr/local/bin/gcc-10 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/private/var/folders/5q/xc22bbms0qjdgmpsv2188ydh0000gn/T/pip-build-env-q66c57aj/overlay/lib/python3.9/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pynbody/gravity/_gravity.c -o build/temp.macosx-10.9-x86_64-3.9/pynbody/gravity/_gravity.o -fopenmp" failed with exit status 1
I have MacOS 11.0.1 and python 3.9.0 and pip 20.2.4.
I can install other packages via pip such as numpy.
How can I install pynbody on MacOS?
(The same procedure worked on ubuntu.)
The Xcode developer tools are installed.
I upgraded my Mac to macOS Sierra and I had to start a new account. Right now I am trying to establish my environment. I ran into a problem installing pyaudio. The procedure I used is first use homebrew and install port audio.
brew install portaudio
It installs with no errors.
I proceed to install pyaudio using pip
pip install pyaudio
I receive the following error message.
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 -DMACOSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_portaudiomodule.c -o build/temp.macosx-10.12-intel-2.7/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
portaudio.h is available in /usr/local/Cellar/portaudio/19.20140130/include
I am unfamiliar with pip and don't know how to pass the path to the complier.
Any help will be greatly appreciated.
thanks
Rod
Thanks for the suggestion. I tried it but it did not work.
It seems pip is not finding both include files and libraries when attempting to install in macOS Sierra
I did some digging into how to pass paths with pip and I successfully installed pyaudio using the following command.
sudo python3 -B -u -m pip -v install --no-warn-script-location --no-cache-dir --global-option=build_ext --global-option="-I$(brew --prefix portaudio)/include" --global-option="-L$(brew --prefix portaudio)/lib" pyaudio
Please try the command below.
sudo CPATH="$CPATH:/usr/local/include" LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib" pip install pyaudio
You can add the directory to your CPATH. Try:
CPATH="$CPATH:/usr/local/Cellar/portaudio/19.20140130/include"
pip install pyaudio
I am tying to build PIL 1.1.7 on Mac OS X 10.7, I am getting this error:
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/opt/local/include -I/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.3-fat-2.6/_imaging.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
I have the latest Xcode installed. gcc-4.0 does not exist but gcc-4.2 does. I don't know why it's trying to use gcc-4.0.
You appear to be using a 32-bit-only Python possibly one downloaded from python.org. They are built with gcc-4.0 and for the i386 and ppc archs for compatibility with multiple OS X versions. When building a C extension module, Python's Distutils will attempt to use the same compiler version and options that Python itself was build with. Because gcc-4.0 and support for the ppc architecture are no longer included with Xcode 4 and OS X 10.7, you should not use the 32-bit-only builds on 10.7 if you need to build extension modules. Either install a 64-bit/32-bit version of Python (2.7.2 and 3.2.2 are current from python.org) or use the Apple-supplied system Pythons in 10.7 (/usr/bin/python which defaults to 2.7.1).
I followed the installation instructions for installing oursql on Mac OS X. Since
sudo pip install oursql
told me, that it couldn't find mysql_config I (located it with locate mysql_config and) told it where to find it by
sudo MYSQL_CONFIG=/usr/local/mysql-5.5.14-osx10.6-x86_64/bin/mysql_config pip install oursql
I added the terminal output at the bottom for readability reasons. After that I fired up python in terminal (On Mac OS Lion it is python 2.7 now,...) and did
>>> import oursql
but python keeps telling me:
>>> import oursql
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/oursql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/oursql.so
Reason: image not found
What do I miss? Any suggestions?
Terminal Output, of pip installation:
Downloading/unpacking oursql
Downloading oursql-0.9.2.tar.bz2 (113Kb): 113Kb downloaded
Running setup.py egg_info for package oursql
Installing collected packages: oursql
Running setup.py install for oursql
skipping 'oursqlx/oursql.c' Cython extension (up-to-date)
building 'oursql' extension
/usr/local/mysql-5.5.14-osx10.6-x86_64/bin/mysql_config --cflags
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 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c oursqlx/oursql.c -o build/temp.macosx-10.7-intel-2.7/oursqlx/oursql.o -I/usr/local/mysql-5.5.14-osx10.6-x86_64/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64
oursqlx/oursql.c: In function ‘__pyx_pf_6oursql_10Connection___cinit__’:
oursqlx/oursql.c:4630: warning: implicit conversion shortens 64-bit value into a 32-bit value
oursqlx/oursql.c: In function ‘__pyx_pf_6oursql_10_Statement_execute’:
oursqlx/oursql.c:10219: warning: implicit conversion shortens 64-bit value into a 32-bit value
oursqlx/oursql.c: In function ‘__pyx_pf_6oursql_16_DBAPITypeObject___richcmp__’:
oursqlx/oursql.c:17597: warning: implicit conversion shortens 64-bit value into a 32-bit value
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 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c oursqlx/compat.c -o build/temp.macosx-10.7-intel-2.7/oursqlx/compat.o -I/usr/local/mysql-5.5.14-osx10.6-x86_64/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64
/usr/local/mysql-5.5.14-osx10.6-x86_64/bin/mysql_config --libs
llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.7-intel-2.7/oursqlx/oursql.o build/temp.macosx-10.7-intel-2.7/oursqlx/compat.o -o build/lib.macosx-10.7-intel-2.7/oursql.so -L/usr/local/mysql-5.5.14-osx10.6-x86_64/lib -lmysqlclient -lpthread
ld: warning: ignoring file build/temp.macosx-10.7-intel-2.7/oursqlx/oursql.o, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file build/temp.macosx-10.7-intel-2.7/oursqlx/compat.o, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file /usr/local/mysql-5.5.14-osx10.6-x86_64/lib/libmysqlclient.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Successfully installed oursql
Cleaning up...
This did the job:
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"
If you don't want to install a full MySQL you can compile oursql with the mysql-connector-c.
Download mysql-connector-c, unzip and install:
wget http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.0.2-osx10.5-x86-64bit.tar.gz/from/http://cdn.mysql.com/
tar -xvf mysql-connector-c-6-1.0.2-osx10.5-x86-64bit.tar
cd mysql-connector-c-6.0.2-osx10.5-x86-64bit
sudo cp bin/* /usr/local/bin/
sudo cp lib/* /usr/local/lib/
sudo cp -r include/* /usr/local/include/
Download and unzip oursql:
wget --no-check-certificate https://launchpad.net/oursql/py3k/py3k-0.9.3/+download/oursql-0.9.3.zip
unzip oursql-0.9.3.zip
Compile oursql:
cd oursql-0.9.3
sudo python setup.py build_ext
This has been verified to work with OSX 10.8.2, Xcode 4.5.2 and Python 3.2.3
I came across this question looking for a solution to installing oursql on OSX 10.10.5. I had previously installed mysql using brew brew install mysql. For those looking to install oursql on yosemite, here is what works for me:
1) Download the package manually. See links here.
2) Open oursql/oursql-0.9.3.1/oursqlx/_exceptions.c in your favourite text editor
3) Comment the last “default”, should look something like this:
/*default:
if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST)
return _oursqlx_ProgrammingError;
else if (err > CR_MIN_ERROR && err < CR_MAX_ERROR)
return _oursqlx_InterfaceError;*/
4) Now try running setup again:
[sudo] python setup.py install
The best way for installing mysql-server on mac os snow leopard is trying to install from source file in order to make sure you are compiling mysql for the correct architecture x86_64.
First of all I am very new to all this.
I recently upgraded to Snow Leopard and installed the Xcode + iPhone dev package, 3.1.2.
I went on to install the Django framework + MYSQLDB handler. During the build stage, the terminal shows me the gcc exit status 1 error. But I have the Xcode already installed?
Where am I going wrong?
Also while trying to fix things up, I installed the Xcode that came with the Snow Leopard DVD. still the same error.
Now I think I should remove the Xcode completely and do a fresh install?
Is the ver.3.1.2 specific to 32-bit? Please help me out.
Here is the complete error:
Amit-Vermas-MacBook:mysql-python-1.2.2 amitverma$ gcc-4.0
i686-apple-darwin10-gcc-4.0.1: no input files
Amit-Vermas-MacBook:mysql-python-1.2.2 amitverma$ python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.5/MySQLdb
running build_ext
building '_mysql' extension
gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.3-i386-2.5/_mysql.o -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
cc1: error: unrecognized command line option "-Wno-long-double"
error: command 'gcc' failed with exit status 1
I am not sure if you solved your problem. I got the exact same issue after I upgraded from Mac OS 10.4 to 10.6.
Following some blog posts, on a hunch, I ran setup.py pointing to an older gcc version (gcc-4.0).
CC='/usr/bin/gcc-4.0' python setup.py build
The build encountered few warnings.
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.5/MySQLdb
running build_ext
building '_mysql' extension
/usr/bin/gcc-4.0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'gamma',1) -D__version__=1.2.3c1 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.3-i386-2.5/_mysql.o -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:1050:1: warning: "HAVE_WCSCOLL" redefined
In file included from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:8,
from pymemcompat.h:10,
from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h:724:1: warning: this is the location of the previous definition
gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386-2.5/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lz -lm -lmygcc -o build/lib.macosx-10.3-i386-2.5/_mysql.so
ld: warning: in build/temp.macosx-10.3-i386-2.5/_mysql.o, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
Ran the same command again.
Everything works now magically. The install also went through. The module works as expected.
It normally also shows why a compilation fails. Could you give the text preceding "gcc exited with code 1" or something like that? And perhaps the source file also.
Also look for other threads on this subject, like this one. Good search terms on google or stack overflow are leopard and MySQLdb.
If it helps any, I solved this issue with sym links, and I think it will work for you. I wrote this with my version of gcc in mind, which is 4.2:
cd /usr/bin
rm cc gcc c++ g++
ln -s gcc-4.2 cc
ln -s gcc-4.2 gcc
ln -s c++-4.2 c++
ln -s g++-4.2 g++
ln -s gcc-4.2 gcc-4.0
There ya go!