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?

  1. Downloaded python 2.5.1
  2. Downloaded easy_install
  3. 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
>>> sys.path
[”, ‘/Library/Frameworks/Python.framework/Versions/2.5/lib/

python2.5/site-packages/SQLAlchemy-0.4…egg’, ]

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)

Using SQLAlchemy:

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/, 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/
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.

Lesson Learned:

Google Search is very Python friendly, use it extensively.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

What’s this?

You are currently reading Python: SQLAlchemy & MySQL installation problems… at RAPD.


%d bloggers like this: