List:General Discussion« Previous MessageNext Message »
From:Larry Martell Date:January 9 2012 9:21pm
Subject:Problem installing python MySQLdb on Mac OS X Version 10.5.8
View as plain text  
Some may consider this slightly off-topic, but I'm out of places to
turn to, so I'm hoping someone here can help me.


I am having no luck with getting the python module MySQLdb to work on
my Mac. I am getting the dreaded 'wrong architecture' message when I
try to import the module. I googled this, and found this page:

http://stackoverflow.com/questions/3061277/python-mysql-wrong-architecture-error

Following the instructions there I found that I did indeed have the 64
bit MySQL and a 32 bit python. I rectified that by deleting the 64-bit
install and then installing the 32-bit. Here's confirmation of that:

$ python -c 'import platform; print platform.platform()'
Darwin-9.8.0-i386-32bit

$ ls -l /usr/local/mysql
lrwxr-xr-x  1 root  wheel  24 Jan  8 22:09 /usr/local/mysql ->
mysql-5.5.19-osx10.5-x86

I rebuilt and reinstalled, but no joy. I added the env vars to my
.profile as suggested on that web page:

PATH="/usr/local/mysql/bin:${PATH}"
export PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
export VERSIONER_PYTHON_PREFER_64_BIT=no
export VERSIONER_PYTHON_PREFER_32_BIT=yes
export ARCHFLAGS="-arch i386"

Sourced my .profile, rebuilt and reinstalled, same error.

I'm thinking that perhaps something from the build I did when I had I
the 64-bit MySQL is getting left behind and messing up the new build.
But I don't know what that could be.

Any help anyone could provide will be greatly appreciated. Below I've
pasted the error I get, as well as the output from the build and
install:

$ python
Python 2.6.7 (r267:88850, Jan  7 2012, 13:37:49)
[GCC 4.0.1 (Apple Inc. build 5490)] 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 "build/bdist.macosx-10.4-i386/egg/MySQLdb/__init__.py", line
19, in <module>
 File "build/bdist.macosx-10.4-i386/egg/_mysql.py", line 7, in <module>
 File "build/bdist.macosx-10.4-i386/egg/_mysql.py", line 6, in __bootstrap__
ImportError:
dlopen(/Users/user/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.4-i386.egg-tmp/_mysql.so,
2): no suitable image found.  Did find:
     
 /Users/user/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.4-i386.egg-tmp/_mysql.so:
mach-o, but wrong architecture

$ python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.4-i386-2.6/MySQLdb
running build_ext

$ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.4-i386/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.4-i386-2.6/MySQLdb
running build_ext
creating build/bdist.macosx-10.4-i386/egg
copying build/lib.macosx-10.4-i386-2.6/_mysql.so ->
build/bdist.macosx-10.4-i386/egg
copying build/lib.macosx-10.4-i386-2.6/_mysql_exceptions.py ->
build/bdist.macosx-10.4-i386/egg
creating build/bdist.macosx-10.4-i386/egg/MySQLdb
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/__init__.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/connections.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb
creating build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/constants/__init__.py
-> build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/constants/CLIENT.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/constants/CR.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/constants/ER.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/constants/FIELD_TYPE.py
-> build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/constants/FLAG.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/constants/REFRESH.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb/constants
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/converters.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/cursors.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/release.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb
copying build/lib.macosx-10.4-i386-2.6/MySQLdb/times.py ->
build/bdist.macosx-10.4-i386/egg/MySQLdb
byte-compiling build/bdist.macosx-10.4-i386/egg/_mysql_exceptions.py
to _mysql_exceptions.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/__init__.py to
__init__.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/connections.py
to connections.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/constants/__init__.py
to __init__.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/constants/CLIENT.py
to CLIENT.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/constants/CR.py
to CR.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/constants/ER.py
to ER.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/constants/FIELD_TYPE.py
to FIELD_TYPE.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/constants/FLAG.py
to FLAG.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/constants/REFRESH.py
to REFRESH.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/converters.py
to converters.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/cursors.py to
cursors.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/release.py to
release.pyc
byte-compiling build/bdist.macosx-10.4-i386/egg/MySQLdb/times.py to times.pyc
creating stub loader for _mysql.so
byte-compiling build/bdist.macosx-10.4-i386/egg/_mysql.py to _mysql.pyc
creating build/bdist.macosx-10.4-i386/egg/EGG-INFO
copying MySQL_python.egg-info/PKG-INFO ->
build/bdist.macosx-10.4-i386/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt ->
build/bdist.macosx-10.4-i386/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt ->
build/bdist.macosx-10.4-i386/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt ->
build/bdist.macosx-10.4-i386/egg/EGG-INFO
writing build/bdist.macosx-10.4-i386/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating 'dist/MySQL_python-1.2.3-py2.6-macosx-10.4-i386.egg' and
adding 'build/bdist.macosx-10.4-i386/egg' to it
removing 'build/bdist.macosx-10.4-i386/egg' (and everything under it)
Processing MySQL_python-1.2.3-py2.6-macosx-10.4-i386.egg
Removing
/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.4-i386.egg
Copying MySQL_python-1.2.3-py2.6-macosx-10.4-i386.egg to
/usr/local/lib/python2.6/site-packages
MySQL-python 1.2.3 is already the active version in easy-install.pth

Installed
/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.4-i386.egg
Processing dependencies for MySQL-python==1.2.3
Finished processing dependencies for MySQL-python==1.2.3

TIA!
-larry
Thread
Problem installing python MySQLdb on Mac OS X Version 10.5.8Larry Martell9 Jan
  • Re: Problem installing python MySQLdb on Mac OS X Version 10.5.8Larry Martell9 Jan