Menu

ImportError on Mac : Library not loaded

Help
2007-10-01
2012-09-19
  • Jitendra Agrawal

    Hi Folks:

    I am trying to get MySQL-python-1.2.2 working with Python 2.3.5 and mysql 5.0.45 on Mac OS X 10.4.8

    I get following error when I execute my test script:

    Traceback (most recent call last):
    File "./test.py", line 6, in ?
    import MySQLdb;
    File "build/bdist.darwin-8.10.0-Power_Macintosh/egg/MySQLdb/init.py", line 19, in ?
    File "build/bdist.darwin-8.10.0-Power_Macintosh/egg/_mysql.py", line 7, in ?
    File "build/bdist.darwin-8.10.0-Power_Macintosh/egg/_mysql.py", line 6, in bootstrap
    ImportError: dlopen(/Users/Jeet/.python-eggs/MySQL_python-1.2.2-py2.3-macosx-10.4-ppc.egg-tmp/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib
    Referenced from: /Users/Jeet/.python-eggs/MySQL_python-1.2.2-py2.3-macosx-10.4-ppc.egg-tmp/_mysql.so
    Reason: image not found

    If you notice the library is being searched at incorrect path. I do have the library at /usr/local/mysql. But it is being searched at /usr/local/mysql/lib/mysql.

    Any help would be appreciated.

    Thanks in advance.

    Best regards,
    Jeet

     
    • mika

      mika - 2007-10-29

      The clue is in Library not loaded: /usr/local/mysql/lib/mysql/... check if you have this path. It is VERY likely you don't. You probably have: /usr/local/mysql/lib

      so cd there and create a symlink for mysql (ln . mysql)

      Also, I was tripped by PYTHON_EGG_CACHE env variable. By default it will create .python-eggs in your home dir, and your apache (or whatever runs your scripts) might not have access to it. Set it up to /tmp/somethig.

       
      • Lukasz

        Lukasz - 2007-10-29

        OK. But...
        What if i compile for development (alias mode) everything is OK, for deployment - not. Library not found.

        :-(

        Ł

         
    • Leo Hourvitz

      Leo Hourvitz - 2007-10-01

      I'm sorry I don't have the exact instructions, but I remember that to get this all working, I had to build MySQLdb (MySQL-python) from source. If your mysql_config commands correctly reports that library location you should be able to get the source build going...

      Sorry I don't have more specific instructions, good luck. I've just emerged from fighting this stuff to get Apache2.0+mod_python+Django+Mysql-Python+MySQL all working both lcoally and for deployment. It was a lot easier on Linux (our deployment box) than on my laptop (Mac OS 10.4.8)!

       
    • Jitendra Agrawal

      Thanks. I just copied the library at the 'wrong' location and got it all working.

       
    • Lukasz

      Lukasz - 2007-10-20

      Could you tell exactly where "wrong" location is? Same problem.... hard to solve..

       

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.