Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8903309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:50:13+00:00 2026-06-15T01:50:13+00:00

I spent two full days trying to get python-mysql working on my clean install

  • 0

I spent two full days trying to get python-mysql working on my clean install of Lion last year and in the end gave up in despair. Having upgraded to Mountain Lion I thought I would give it another try but with no success. It may be that all my attempts with Lion have screwed up my settings and my only hope is a clean install, but just in case anyone can rescue me, here are the symptoms.

First I deleted the three versions still in existence:

/Users/phoebebr/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-i386.egg-tmp
/Users/phoebebr/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-i386.egg-tmp/_mysql.so
/Users/phoebebr/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp
/Users/phoebebr/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so
/Users/phoebebr/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-x86_64.egg-tmp
/Users/phoebebr/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-x86_64.egg-tmp/_mysql.so

Then reinstalled. All appears to go ok, though with warnings, and seems to be 64 bit version:

    Phoebe-Brights-iMac:.python-eggs phoebebr$ sudo pip install mysql-python
    dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
    Password:
    Downloading/unpacking mysql-python
      Downloading MySQL-python-1.2.4c1.zip (113kB): 113kB downloaded
      Running setup.py egg_info for package mysql-python
        Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
        Extracting in /tmp/tmp7fFOxU
        Now working in /tmp/tmp7fFOxU/distribute-0.6.28
        Building a Distribute egg in /private/tmp/pip-build/mysql-python
        /private/tmp/pip-build/mysql-python/distribute-0.6.28-py2.7.egg

    Installing collected packages: mysql-python
      Running setup.py install for mysql-python
        building '_mysql' extension
        clang -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 -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'rc',5) -D__version__=1.2.4c1 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.8-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
        clang: warning: argument unused during compilation: '-mno-fused-madd'
        In file included from _mysql.c:44:
        /usr/local/mysql/include/my_config.h:330:11: warning: 'SIZEOF_SIZE_T' macro redefined
          #define SIZEOF_SIZE_T  SIZEOF_LONG
                  ^
        /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
        #        define SIZEOF_SIZE_T           8
                        ^
        In file included from _mysql.c:44:
        /usr/local/mysql/include/my_config.h:423:9: warning: 'HAVE_WCSCOLL' macro redefined
        #define HAVE_WCSCOLL
                ^
        /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h:891:9: note: previous definition is here
        #define HAVE_WCSCOLL 1
                ^
        _mysql.c:287:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                        cmd_argc = PySequence_Size(cmd_args);
                                 ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
        _mysql.c:317:12: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                        groupc = PySequence_Size(groups);
                               ~ ^~~~~~~~~~~~~~~~~~~~~~~
        _mysql.c:470:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                                int j, n2=PySequence_Size(fun);
                                       ~~ ^~~~~~~~~~~~~~~~~~~~
        _mysql.c:1105:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                        len = mysql_real_escape_string(&(self->connection), out, in, size);
                            ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        _mysql.c:1107:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                        len = mysql_escape_string(out, in, size);
                            ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        _mysql.c:1146:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                size = PyString_GET_SIZE(s);
                     ~ ^~~~~~~~~~~~~~~~~~~~
        /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:92:32: note: expanded from macro 'PyString_GET_SIZE'
        #define PyString_GET_SIZE(op)  Py_SIZE(op)
                                       ^
        /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'
        #define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
        _mysql.c:1156:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                        len = mysql_real_escape_string(&(self->connection), out+1, in, size);
                            ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        _mysql.c:1158:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                        len = mysql_escape_string(out+1, in, size);
                            ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        _mysql.c:1252:11: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
                if ((n = PyObject_Length(o)) == -1) goto error;
                       ~ ^~~~~~~~~~~~~~~~~~
        /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
        #define PyObject_Length PyObject_Size
                                ^
        _mysql.c:1444:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
                                len = strlen(buf);
                                    ~ ^~~~~~~~~~~
        _mysql.c:1446:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
                                len = strlen(buf);
                                    ~ ^~~~~~~~~~~
        _mysql.c:1482:11: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
                                        len = strlen(buf);
                                            ~ ^~~~~~~~~~~
        _mysql.c:1484:11: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
                                        len = strlen(buf);
                                            ~ ^~~~~~~~~~~
        _mysql.c:1567:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                if (how < 0 || how >= sizeof(row_converters)) {
                    ~~~ ^ ~
        16 warnings generated.
        clang -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.8-intel-2.7/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lpthread -o build/lib.macosx-10.8-intel-2.7/_mysql.so -arch x86_64

    Successfully installed mysql-python
    Cleaning up…

But it still won’t import:

    Phoebe-Brights-iMac:.python-eggs phoebebr$ python
    Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
    [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.

    >>> import MySQLdb
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
        import _mysql
    ImportError: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
      Referenced from: /Library/Python/2.7/site-packages/_mysql.so
      Reason: image not found

And yet the file it is trying to load is there!

    Phoebe-Brights-iMac:/ phoebebr$ cd  /Library/Python/2.7/site-packages
    Phoebe-Brights-iMac:site-packages phoebebr$ ls
    total 792
    drwxr-xr-x  4 root  wheel     136 25 Oct 09:31 Django-1.4.2-py2.7.egg
    drwxr-xr-x  2 root  wheel     238 23 Nov 11:16 MySQL_python-1.2.4c1-py2.7.egg-info
    drwxr-xr-x  3 root  wheel     510 23 Nov 11:16 MySQLdb
    -rw-r--r--  1 root  wheel     119 11 Oct 23:59 README
    -rwxr-xr-x  1 root  wheel   67240 23 Nov 11:16 _mysql.so
    -rw-r--r--  1 root  wheel    2352 23 Nov 11:16 _mysql_exceptions.py
    -rw-r--r--  1 root  wheel    4243 23 Nov 11:16 _mysql_exceptions.pyc
    -rw-r--r--  1 root  wheel     306 23 Nov 10:37 easy-install.pth
    drwxr-xr-x  4 root  wheel     136 23 Nov 10:37 pip-1.2.1-py2.7.egg
    -rw-r--r--  1 root  wheel  295372 22 Oct 20:21 pymongo-2.3-py2.7-macosx-10.8-intel.egg
    -rw-r--r--  1 root  wheel   17994 22 Oct 20:22 sleepy.mongoose-0.1-py2.7.egg
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:50:14+00:00Added an answer on June 15, 2026 at 1:50 am

    In the past, I’ve always run into the libmysqlclient.18.dylib error on fresh installs.

    This usually does the trick for me.

    sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
    

    I just had to do a clean install of Mountain Lion, and am having new issues with this package now. v1.2.4 is really new. You may try pip install MySQL-python==1.2.3 just to be safe as 1.2.4 is still RC1 I think.

    Edit:

    I’m a tard and installed 32bit MySQL on accident. 1.2.4c1 does indeed work. And as I would recommend using the export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/ instead of doing the symlink.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've spent the past two days just trying to enable the sending of email
I am new to programming (day 3) and I spent the last two days
I've spent two days on this and have gotten nowhere. I'm trying to use
I have spent the last two days reading up on this and ultimately have
I am still new to the storyboard stuff. I spent two days debugging this
I have spent two day trying to figure it out. I have implemented two
I've spent two days on this and I still can't find the cause of
I've spent two days on this so far and combed through every source at
I spent around two hours on that problem, and I have visited these stackoverflow
Spent a solid hour trying to sort out why on earth this (coffeescript) $.ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.