Python: SQLAlchemy & MySQL installation problems…
November 1, 2007 § Leave a comment
Another dependency issue happened again to me while re-installing my python development environment.
What did I do to re-install Python?
- Downloaded python 2.5.1
- Downloaded easy_install
- Installed every modules using easy_install (w/o version number, so that I get the most recent stable build)
What went wrong?
1. SQLAlchemy import was messed up. All the sudden I couldn’t import create_session…
What did I do?
>>> import sys
Nothing is weird, but this Google Group discussion mentioned that an unrelated project had similar dependency issue to mine. Their solution is to downgrade SQLAlchemy to 0.3.10 (version 0.3.11 is also OK)
easy_install -U “SQLAlchemy==0.3.11″
Voila, import problem solved.
2. Cannot run MySQL_python because of missing dot so file, now that’s messed up big time. This is the snippet of the error:
ImportError: dlopen(~/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib
Referenced from: ~/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so
Reason: image not found
What did I do?
Googling this problem, reveal the cure for it:
sudo mkdir /usr/local/mysql/lib/mysql
sudo cp /usr/local/mysql/lib/libmysqlclient_r.15.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib
Apparently the particular mysql lib file is located in the wrong folder.
Done, now the project runs smoothly the way it was before.
Google Search is very Python friendly, use it extensively.