Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Getting started with python on macintosh snow leopard with mysql -need help

Reply
Thread Tools

Getting started with python on macintosh snow leopard with mysql -need help

 
 
dk
Guest
Posts: n/a
 
      07-11-2010
I have been going round and round trying to configure python 2.6
running on osx 10.6.x to work with mySQL 5.1.44.
Python seems to work ... i have an installation of mysql 5.1.44
running and have used it in conjunction for other php/apache projects.

I want to learn python and think i need a better database then mysql
lite that installs with the web2py frame work, so my quest to connect
to mysql or postgres began.

I seem to be stuck stuck getting mySQLdb drivers installed. I down
loaded python 2.6.5 from the python site and MySQL-python-1.2.3 from
the my sql site.
I have worked past numerous errors by i now get the errors below when
i try to compile.

-- some background that might help anyone kind enough to have read
this far and who might be inclined to take pitty --
I have (tried) to use macports to install setuptools (which MySQL-
python-1.2.3 says it needs).
MacPorts has put tons of stuff in /opt/local ... so i am not sure i am
using this tool the way its intended.
this could all be as simple as adding some path declarations in the
right place but where?

lots of the post i have seen on the subject talk about 32/64
installation ... it makes sense that you might need to be consistent
in getting your components to work together, but i am not sure how i
tell of the various parts i have install which and how they were
compiled.

whereis python display /usr/bin/python
python -v spits out lots ... but here is a sample:

# /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
encodings/utf_8.pyc matches /Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/encodings/utf_8.py
import encodings.utf_8 # precompiled from /Library/Frameworks/
Python.framework/Versions/2.6/lib/python2.6/encodings/utf_8.pyc
Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin





when i try to compile mysql-python-1.2.3 i get the following error
returned from python setup.py build -----

building '_mysql' extension
gcc-4.0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing
-fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -
D__version__=1.2.3 -I/usr/local/mysql/include -I/Library/Frameworks/
Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/
temp.macosx-10.3-fat-2.6/_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
In file included from /Library/Frameworks/Python.framework/Versions/
2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/
2.6/include/python2.6/Python.h:85,
from pymemcompat.h:10,
from _mysql.c:29:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error:
stdarg.h: No such file or directory
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:1053:1: warning: "HAVE_WCSCOLL"
redefined
In file included from /Library/Frameworks/Python.framework/Versions/
2.6/include/python2.6/Python.h:8,
from pymemcompat.h:10,
from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/
pyconfig.h:808:1: warning: this is the location of the previous
definition
error: command 'gcc-4.0' failed with exit status 1
 
Reply With Quote
 
 
 
 
Benjamin Kaplan
Guest
Posts: n/a
 
      07-12-2010
On Sun, Jul 11, 2010 at 1:18 PM, dk <(E-Mail Removed)> wrote:
> I have been going round and round trying to configure python 2.6
> running on osx 10.6.x to work with mySQL 5.1.44.
> Python seems to work ... i have an installation of mysql 5.1.44
> running and have used it in conjunction for other php/apache projects.
>
> I want to learn python and think i need a better database then mysql
> lite that installs with the web2py frame work, so my quest to connect
> to mysql or postgres began.
>
> I seem to be stuck stuck getting mySQLdb drivers installed. *I down
> loaded python 2.6.5 from the python site and MySQL-python-1.2.3 from
> the my sql site.
> I have worked past numerous errors by i now get the errors below when
> i try to compile.
>
> -- some background that might help anyone kind enough to have read
> this far and who might be inclined to take pitty --
> I have (tried) to use macports to install setuptools (which MySQL-
> python-1.2.3 says it needs).
> MacPorts has put tons of stuff in /opt/local ... so i am not sure i am
> using this tool the way its intended.
> this could all be as simple as adding some path declarations in the
> right place but where?
>


That could be part of your problem. Macports basically ignores the
rest of the system. Setuptools depends on python, so Macports compiles
and installs its own version of Python in /opt/local. So you now have
3 different versions of Python 2.6 on your computer: /usr/bin/python
(the System python), /usr/local/bin/python (the Python.org python) and
/opt/local/Library/Frameworks/Python.Framework/Versions/2.6/bin/python.
You can use Macport's python-select package to choose which one is the
default (it symlinks one of them to /opt/local/bin/python which should
be first on your path).

Anyway, as long as you're using Macports :

sudo port install py26-mysql

that should solve most of your problems

> lots of the post i have seen on the subject talk about 32/64
> installation ... it makes sense that you might need to be consistent
> in getting your components to work together, but i am not sure how i
> tell of the various parts i have install which and how they were
> compiled.
>
> whereis python *display */usr/bin/python
> python -v spits out lots ... but here is a sample:
>
> # /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
> encodings/utf_8.pyc matches /Library/Frameworks/Python.framework/
> Versions/2.6/lib/python2.6/encodings/utf_8.py
> import encodings.utf_8 # precompiled from /Library/Frameworks/
> Python.framework/Versions/2.6/lib/python2.6/encodings/utf_8.pyc
> Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
>
>
>
>
>
> when i try to compile mysql-python-1.2.3 i get the following error
> returned from python setup.py build -----
>
> building '_mysql' extension
> gcc-4.0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing
> -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -
> D__version__=1.2.3 -I/usr/local/mysql/include -I/Library/Frameworks/
> Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/
> temp.macosx-10.3-fat-2.6/_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
> In file included from /Library/Frameworks/Python.framework/Versions/
> 2.6/include/python2.6/unicodeobject.h:4,
> * * * * * * * * from /Library/Frameworks/Python.framework/Versions/
> 2.6/include/python2.6/Python.h:85,
> * * * * * * * * from pymemcompat.h:10,
> * * * * * * * * from _mysql.c:29:
> /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error:
> stdarg.h: No such file or directory
> In file included from _mysql.c:36:
> /usr/local/mysql/include/my_config.h:1053:1: warning: "HAVE_WCSCOLL"
> redefined
> In file included from /Library/Frameworks/Python.framework/Versions/
> 2.6/include/python2.6/Python.h:8,
> * * * * * * * * from pymemcompat.h:10,
> * * * * * * * * from _mysql.c:29:
> /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/
> pyconfig.h:808:1: warning: this is the location of the previous
> definition
> error: command 'gcc-4.0' failed with exit status 1
> --


Strange. Seems that the package is trying to use gcc-4.0 and the
MacOSX10.4 SDK. The default version of gcc on Snow Leopard is 4.2, and
XCode only comes with the SDKs for the previous two versions of OS X.
 
Reply With Quote
 
 
 
 
Ned Deily
Guest
Posts: n/a
 
      07-14-2010
In article
<(E-Mail Removed)>,
Benjamin Kaplan <(E-Mail Removed)> wrote:

> On Sun, Jul 11, 2010 at 1:18 PM, dk <(E-Mail Removed)> wrote:

[...]
> > when i try to compile mysql-python-1.2.3 i get the following error
> > returned from python setup.py build -----
> >
> > building '_mysql' extension
> > gcc-4.0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing
> > -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -
> > D__version__=1.2.3 -I/usr/local/mysql/include -I/Library/Frameworks/
> > Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/
> > temp.macosx-10.3-fat-2.6/_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
> > In file included from /Library/Frameworks/Python.framework/Versions/
> > 2.6/include/python2.6/unicodeobject.h:4,
> > * * * * * * * * from /Library/Frameworks/Python.framework/Versions/
> > 2.6/include/python2.6/Python.h:85,
> > * * * * * * * * from pymemcompat.h:10,
> > * * * * * * * * from _mysql.c:29:
> > /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error:
> > stdarg.h: No such file or directory
> > In file included from _mysql.c:36:
> > /usr/local/mysql/include/my_config.h:1053:1: warning: "HAVE_WCSCOLL"
> > redefined
> > In file included from /Library/Frameworks/Python.framework/Versions/
> > 2.6/include/python2.6/Python.h:8,
> > * * * * * * * * from pymemcompat.h:10,
> > * * * * * * * * from _mysql.c:29:
> > /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/
> > pyconfig.h:808:1: warning: this is the location of the previous
> > definition
> > error: command 'gcc-4.0' failed with exit status 1
> > --

>
> Strange. Seems that the package is trying to use gcc-4.0 and the
> MacOSX10.4 SDK. The default version of gcc on Snow Leopard is 4.2, and
> XCode only comes with the SDKs for the previous two versions of OS X.


Not strange at all. The python.org Python 2.6 (which is installed to
/Library/Frameworks/Python.framework) is deliberately built to be
compatible with OS X 10.3.9 through 10.6 and, as such, requires gcc-4.0
and the 10.4u SDK. The latter is included in the 10.6 Xcode
distribution as a separate package but is not installed by default; to
build a Python C extension module for that Python, you need to go back
to the Xcode installer for Snow Leopard (or download a new one from
Apple) and do a custom installation of that SDK.

--
Ned Deily,
http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem compiling Python 3.2 in 32bit on Snow Leopard Gregory Ewing Python 2 07-11-2011 10:33 PM
ANN: SuPy 1.6 for Snow Leopard and Python 2.7 Greg Ewing Python 0 04-23-2011 06:32 AM
QTKit glitchy on Snow Leopard Server - Help! Spencer Rogers Ruby 5 04-15-2010 05:58 PM
python version in snow leopard? Alia Khouri Python 2 06-09-2009 08:47 AM
Getting started with OS X Leopard Mark Carter Python 7 03-15-2008 09:35 PM



Advertisments