ImportError: No module named pysqlite2

Currently my favorite web app environment includes:

  • CentOS 5.5
  • Python 2.6 (built from source)
  • Pylons 1.0 (w/ SQLAlchemy 0.5.8)
  • nginx

Whenever I setup a new environment, and execute “paster serve –reload development.ini” for the first time, I always get a stack trace from SQLAlchemy that ends with the following error message:

ImportError: No module named pysqlite2

And it always takes me a few minutes to figure out how to fix it again. So I’m taking a few minutes to jot it down here so I don’t forget again!

yum install sqlite-devel -y
easy_install pysqlite