Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard

Graham Dumpleton Graham.Dumpleton at gmail.com
Tue Mar 18 21:26:37 EDT 2008


On Mar 19, 9:47 am, geert <ge... at nznl.com> wrote:
> On Mar 18, 6:56 pm, geert <ge... at nznl.com> wrote:
>
>
>
> > On Mar 14, 1:15 pm, martin.lal... at gmail.com wrote:
>
> > > look athttp://groups.google.be/group/comp.lang.python/browse_thread/thread/d...
>
> > > There is a macpython list that you can consult athttp://www.nabble.com/Python---pythonmac-sig-f2970.html
>
> > Just wanted to let you know that I've solved my problem. The solution
> > is to compile mysql using
>
> > MACOSX_DEPLOYMENT_TARGET=10.5 \
> > CFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
> > LDFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
> > CXXFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
> > ./configure --disable-dependency-tracking  --enable-thread-safe-client
> > --prefix=/usr/local/mysql
>
> > You then go this way to get it running on your machine:
>
> >http://hivelogic.com/articles/installing-mysql-on-mac-os-x/
>
> > Then reinstall MySQLdb. Magic!
>
> > Geert
>
> Seems that I've yelled success to quickly. Everything's ok as long as
> I just run the django dev server, but moving to apache throughmod_wsgibrings a well-known but less than comforting complaint:
>
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]mod_wsgi(pid=2352):
> Exception occurred processing WSGI script '/Users/geert/Sites/LithoNET/
> LN/LNApache.wsgi'., referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1] Traceback (most recent
> call last):, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]   File "/Library/
> Python/2.5/site-packages/django/core/handlers/wsgi.py", line 205, in
> __call__, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]     response =
> self.get_response(request), referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]   File "/Library/
> Python/2.5/site-packages/django/core/handlers/base.py", line 64, in
> get_response, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]     response =
> middleware_method(request), referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]   File "/Library/
> Python/2.5/site-packages/django/contrib/sessions/middleware.py", line
> 13, in process_request, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]     engine =
> __import__(settings.SESSION_ENGINE, {}, {}, ['']), referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]   File "/Library/
> Python/2.5/site-packages/django/contrib/sessions/backends/db.py", line
> 2, in <module>, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]     from
> django.contrib.sessions.models import Session, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]   File "/Library/
> Python/2.5/site-packages/django/contrib/sessions/models.py", line 5,
> in <module>, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]     from django.db
> import models, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]   File "/Library/
> Python/2.5/site-packages/django/db/__init__.py", line 17, in <module>,
> referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]     backend =
> __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), {},
> {}, ['']), referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]   File "/Library/
> Python/2.5/site-packages/django/db/backends/mysql/base.py", line 12,
> in <module>, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1]     raise
> ImproperlyConfigured("Error loading MySQLdb module: %s" % e), referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1] ImproperlyConfigured:
> Error loading MySQLdb module: dlopen(/Library/WebServer/.python-eggs/
> MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): no
> suitable image found.  Did find:, referer:http://localhost/images/
> [Tue Mar 18 23:34:25 2008] [error] [client ::1] \t/Library/
> WebServer/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-
> tmp/_mysql.so: no matching architecture in universal wrapper, referer:http://localhost/images/

Did you again confirm that running:

  file /Library/WebServer/.python-eggs/MySQL_python-1.2.2-py2.5-
macosx-10.5-i386.egg-tmp/_mysql.so

shows the .so having the required architectures, specifically what
Apache runs as (eg. x86_64)?

Do the gcc compiler flags when building and linking the .so file show
all the architecture flags?

Have you empty the Python egg cache to make sure it isn't an older
compiled version?

Graham




More information about the Python-list mailing list