Menu

Problem installing MySQLdb in Mac OSX 10.5.8

Help
2009-12-10
2012-09-19
  • John Stoner

    John Stoner - 2009-12-10

    When I install it, I don't see any problems in the install process, but when I
    go to test the install I see problems.

    I don't think it's a 32/64 bit issue:

    file /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6

    /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6: Mach-O
    universal binary with 2 architectures

    /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 (for
    architecture ppc): Mach-O executable ppc

    /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 (for
    architecture i386): Mach-O executable i386

    file /usr/local/mysql/bin/mysqld

    /usr/local/mysql/bin/mysqld: Mach-O executable i386

    but I still get this:

    python

    Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)

    on darwin

    Type "help", "copyright", "credits" or "license" for more information.

    import MySQLdb

    /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
    packages/MySQL_python-1.2.3c1-py2.6-macosx-10.3-fat.egg/_mysql.py:3:

    UserWarning: Module _mysql was already imported from

    /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
    packages/MySQL_python-1.2.3c1-py2.6-macosx-10.3-fat.egg/_mysql.pyc,

    but /Users/jstoner/Downloads/MySQL-python-1.2.3c1 is being added to sys.path

    Traceback (most recent call last):

    File "<stdin>", line 1, in <module>

    File "MySQLdb/init.py", line 19, in <module>

    import _mysql

    File "build/bdist.macosx-10.3-fat/egg/_mysql.py", line 7, in <module>

    File "build/bdist.macosx-10.3-fat/egg/_mysql.py", line 6, in bootstrap

    ImportError: dynamic module does not define init function (init_mysql)

    any ideas? I see several similar posts on this forum, and no responses.

     
  • Kyle VanderBeek

    Kyle VanderBeek - 2009-12-10

    I don't understand why you're ending up with an _mysql.py. There should really
    only be a _mysql.so. Can you do a completely clean build?

    Also, what is the arch reported by "file _mysql.so" ?

     
  • John Stoner

    John Stoner - 2009-12-10

    crap... in the interim I tried to do a clean build, removed the build and dist
    directories manually, now I'm seeing

    filpython setup.py build

    running build

    running build_py

    creating build

    creating build/lib.macosx-10.3-fat-2.6

    copying _mysql_exceptions.py -> build/lib.macosx-10.3-fat-2.6

    creating build/lib.macosx-10.3-fat-2.6/MySQLdb

    copying MySQLdb/init.py -> build/lib.macosx-10.3-fat-2.6/MySQLdb

    copying MySQLdb/converters.py -> build/lib.macosx-10.3-fat-2.6/MySQLdb

    copying MySQLdb/connections.py -> build/lib.macosx-10.3-fat-2.6/MySQLdb

    copying MySQLdb/cursors.py -> build/lib.macosx-10.3-fat-2.6/MySQLdb

    copying MySQLdb/release.py -> build/lib.macosx-10.3-fat-2.6/MySQLdb

    copying MySQLdb/times.py -> build/lib.macosx-10.3-fat-2.6/MySQLdb

    creating build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    copying MySQLdb/constants/init.py ->
    build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    copying MySQLdb/constants/CR.py ->
    build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    copying MySQLdb/constants/FIELD_TYPE.py ->
    build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    copying MySQLdb/constants/ER.py ->
    build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    copying MySQLdb/constants/FLAG.py ->
    build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    copying MySQLdb/constants/REFRESH.py ->
    build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    copying MySQLdb/constants/CLIENT.py ->
    build/lib.macosx-10.3-fat-2.6/MySQLdb/constants

    running build_ext

    building '_mysql' extension

    creating build/temp.macosx-10.3-fat-2.6

    gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common
    -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'gamma',1)
    -Dversion=1.2.3c1 -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 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.6/includ
    e/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
    :799:1: warning: this is the location of the previous definition

    gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle
    -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.6/_mysql.o
    -L/usr/local/mysql/lib -lmysqlclient_r -lz -lm -lmygcc -o
    build/lib.macosx-10.3-fat-2.6/_mysql.so

    ld: warning in build/temp.macosx-10.3-fat-2.6/_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

     
  • John Stoner

    John Stoner - 2009-12-10

    and to answer your question..

    file build/temp.macosx-10.3-fat-2.6/_mysql.o

    build/temp.macosx-10.3-fat-2.6/_mysql.o: Mach-O object i386

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.