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

Discussion in 'Python' started by dk, Jul 11, 2010.

  1. dk

    dk Guest

    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
     
    dk, Jul 11, 2010
    #1
    1. Advertising

  2. Re: Getting started with python on macintosh snow leopard with mysql- need help

    On Sun, Jul 11, 2010 at 1:18 PM, dk <> 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.
     
    Benjamin Kaplan, Jul 12, 2010
    #2
    1. Advertising

  3. dk

    Ned Deily Guest

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

    In article
    <>,
    Benjamin Kaplan <> wrote:

    > On Sun, Jul 11, 2010 at 1:18 PM, dk <> 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,
     
    Ned Deily, Jul 14, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alia Khouri

    python version in snow leopard?

    Alia Khouri, Jun 9, 2009, in forum: Python
    Replies:
    2
    Views:
    268
    Alia K
    Jun 9, 2009
  2. Roedy Green

    Java hom foer the Mac Snow Leopard?

    Roedy Green, Sep 2, 2009, in forum: Java
    Replies:
    7
    Views:
    386
    Kevin McMurtrie
    Sep 7, 2009
  3. Gregory Ewing
    Replies:
    2
    Views:
    478
    Ned Deily
    Jul 11, 2011
  4. Greg Ewing
    Replies:
    0
    Views:
    242
    Greg Ewing
    Apr 23, 2011
  5. Spencer Rogers
    Replies:
    5
    Views:
    177
    Spencer Rogers
    Apr 15, 2010
Loading...

Share This Page