Hi Mart and Franklin, I have the same problem. I have OS X 10.6 with MySQL from binary installer. I am using python 2.6.6 from ports and yes I have switched it by python_select. I am trying to build it from sources, beacuse py26-mysql is also "building" mysql5 which I do not want, when I have it from installer...
Last time year ago it works perfectly on 1.2.3b and I didn't even think there should be a problem, but now after complete reinstall of the system I want back my working mysql ;-) Here's what I got after build and install: bash-3.2# python setup.py build running build running build_py copying MySQLdb/release.py -> build/lib.macosx-10.6-x86_64-2.6/MySQLdb running build_ext bash-3.2# 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.6-x86_64/egg running install_lib running build_py copying MySQLdb/release.py -> build/lib.macosx-10.6-x86_64-2.6/MySQLdb running build_ext creating build/bdist.macosx-10.6-x86_64/egg copying build/lib.macosx-10.6-x86_64-2.6/_mysql.so -> build/ bdist.macosx-10.6-x86_64/egg copying build/lib.macosx-10.6-x86_64-2.6/_mysql_exceptions.py -> build/ bdist.macosx-10.6-x86_64/egg creating build/bdist.macosx-10.6-x86_64/egg/MySQLdb copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/__init__.py -> build/ bdist.macosx-10.6-x86_64/egg/MySQLdb copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/connections.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb creating build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/constants/__init__.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/constants/CLIENT.py - > build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/constants/CR.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/constants/ER.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/constants/ FIELD_TYPE.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/constants/FLAG.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/constants/REFRESH.py - > build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/converters.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/cursors.py -> build/ bdist.macosx-10.6-x86_64/egg/MySQLdb copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/release.py -> build/ bdist.macosx-10.6-x86_64/egg/MySQLdb copying build/lib.macosx-10.6-x86_64-2.6/MySQLdb/times.py -> build/ bdist.macosx-10.6-x86_64/egg/MySQLdb byte-compiling build/bdist.macosx-10.6-x86_64/egg/_mysql_exceptions.py to _mysql_exceptions.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/__init__.py to __init__.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/ connections.py to connections.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants/ __init__.py to __init__.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants/ CLIENT.py to CLIENT.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants/ CR.py to CR.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants/ ER.py to ER.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants/ FIELD_TYPE.py to FIELD_TYPE.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants/ FLAG.py to FLAG.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/constants/ REFRESH.py to REFRESH.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/ converters.py to converters.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/cursors.py to cursors.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/release.py to release.pyc byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/times.py to times.pyc creating stub loader for _mysql.so byte-compiling build/bdist.macosx-10.6-x86_64/egg/_mysql.py to _mysql.pyc creating build/bdist.macosx-10.6-x86_64/egg/EGG-INFO copying MySQL_python.egg-info/PKG-INFO -> build/bdist.macosx-10.6- x86_64/egg/EGG-INFO copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.macosx-10.6- x86_64/egg/EGG-INFO copying MySQL_python.egg-info/dependency_links.txt -> build/ bdist.macosx-10.6-x86_64/egg/EGG-INFO copying MySQL_python.egg-info/top_level.txt -> build/bdist.macosx-10.6- x86_64/egg/EGG-INFO writing build/bdist.macosx-10.6-x86_64/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.6-x86_64.egg' and adding 'build/bdist.macosx-10.6-x86_64/egg' to it removing 'build/bdist.macosx-10.6-x86_64/egg' (and everything under it) Processing MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg Copying MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg to /opt/local/ Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- packages Adding MySQL-python 1.2.3 to easy-install.pth file Installed /opt/local/Library/Frameworks/Python.framework/Versions/2.6/ lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6- x86_64.egg Processing dependencies for MySQL-python==1.2.3 Finished processing dependencies for MySQL-python==1.2.3 I found the files under /opt/local/Library/Frameworks/Python.framework/ Versions/2.6/lib/python2.6/site-packages/ here I can see MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg and in easy- install.pth is line ./MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg but still after importing in python I got: mIREK$ python Python 2.6.6 (r266:84292, Sep 27 2010, 23:02:58) [GCC 4.2.1 (Apple Inc. build 5664)] 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.6-x86_64/egg/MySQLdb/__init__.py", line 19, in <module> File "build/bdist.macosx-10.6-x86_64/egg/_mysql.py", line 7, in <module> File "build/bdist.macosx-10.6-x86_64/egg/_mysql.py", line 6, in __bootstrap__ ImportError: dlopen(/Users/mIREK/.python-eggs/MySQL_python-1.2.3-py2.6- macosx-10.6-x86_64.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.16.dylib Referenced from: /Users/mIREK/.python-eggs/MySQL_python-1.2.3-py2.6- macosx-10.6-x86_64.egg-tmp/_mysql.so Reason: image not found >>> I really don't know what to do/try more... mIREK On 20 říj, 19:18, mart <msenecal...@gmail.com> wrote: > few questions: > * were you able to install it without any errors? > * that pah below... is pointing to temp... Can you check where it has > been installed to and are sure that what you have os for 2.6, and not > 2.7? - 2.6 is you current version and you have a a path set to it? > (pointing to the actual folder or a link?) > > On Oct 20, 9:13 am, Franklin Freitas <freitas.frank...@gmail.com> > wrote: > > > > > > > > > Hi Mart, > > > Thanks for your detailed explanation. I had tried before with out any > > results. I tried it again anyway from scratch and here is the error I > > get when trying to import MySQLdb > > > >>> import MySQLdb > > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > File "build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", > > line 19, in <module> > > File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in > > <module> > > File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in > > __bootstrap__ > > ImportError: dlopen(/Users/ffreitas/.python-eggs/MySQL_python-1.2.3- > > py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: > > libmysqlclient.16.dylib > > Referenced from: /Users/ffreitas/.python-eggs/MySQL_python-1.2.3- > > py2.6-macosx-10.6-universal.egg-tmp/_mysql.so > > Reason: image not found > > > On Oct 18, 1:33 pm, mart <msenecal...@gmail.com> wrote: > > > > Yes, a little more involved that I remembered. So, to go through the > > > steps correctly, I started from scratch. This is what I did: > > > > 1) downloaded latest version of MySQLdb > > > formhttp://sourceforge.net/projects/mysql-python/ > > > 2) went to my default Python folder, and checked for any file or > > > folder with a reference to *MySQL* (remove if any) > > > 3) opened Vim in a terminal, opened setup_posix.py and made this > > > change (you may not have to do this if MySQL was already installed - > > > but i changed it anyways): > > > > <----- changed this line > > > mysql_config.path = "mysql_config" > > > > ------> to this > > > mysql_config.path = "/usr/local/mysql/bin/mysql_config" > > > > 4) ran these at the terminal: > > > python setup.py clean > > > python setup.py build > > > sudo python setup.py install > > > > 5) for good measure, did an export: export PATH=/usr/local/mysql/bin: > > > $PATH > > > > and there you have it. MyQSLdb is ready to be imported! > > > > good luck and feel free to ask, if you would like me to test a > > > different way of getting it insalled. > > > > Mart :) > > > > On Oct 18, 1:49 am, mart <msenecal...@gmail.com> wrote: > > > > > hum.. let me check on my end to make sure I didn't miss mentioning > > > > something. It has been a little while... > > > > > On Oct 18, 12:40 am, Franklin Freitas <freitas.frank...@gmail.com> > > > > wrote: > > > > > > Hi, the thing is that MySQLdb is not even working outside the Web2py > > > > > environment. I haven't been able to make it work in the regular Python > > > > > interpreter. I tried copying everything to the Web2py sites-packages > > > > > folder, but it didn't work > > > > > > Thanks > > > > > > Franklin > > > > > > On Oct 17, 8:03 pm, mart <msenecal...@gmail.com> wrote: > > > > > > > you can throw in in the installed python/lib folder, or in site- > > > > > > packages folder (sibling to the applications folder of the web2py > > > > > > root > > > > > > dir, or do an export within your scripts (controller?),or.... my > > > > > > favorite, I usually do web2py stuff with Aptana,so, i throw of copy > > > > > > of > > > > > > all dependencies within my project and reference it there... so, > > > > > > many > > > > > > possibilities, depends how you prefer to reference it.... > > > > > > > Hope it helps, > > > > > > Mart :) > > > > > > > On Oct 17, 7:11 pm, Franklin Freitas <freitas.frank...@gmail.com> > > > > > > wrote: > > > > > > > > Has anyone been able to install MySQLdb in Mac OSX ??? > > > > > > > > I want to use it with Web2py but haven't been able to make it > > > > > > > work. > > > > > > > I've read a whole bunch of forums saying how hard it is, I've done > > > > > > > everything I've reead about it without any results. I even used > > > > > > > macports as recommended by my Web2py teacher but it didn't work > > > > > > > either. > > > > > > > > If anyone knows a sure way on how to achieve this I would > > > > > > > appreciate > > > > > > > it. > > > > > > > > Thanks for your time