Our Blog

Aug 17 2010

ImportError: No module named pysqlite2

Jamie Begin

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
wget peak.telecommunity.com/dist/ez_setup.py
python2.6 ez_setup.py
easy_install pysqlite

2 thoughts on “ImportError: No module named pysqlite2”

  1. Curious to know how you get easy_install in this scenario to build against Python2.6 instead of the default Python2.4?

  2. Tony M says:

    Rather than sqlite-devel, I installed libsqlite3-dev (based on this StackOverflow answer) in the global environment, then easy_install’ed pysqlite within one of my virtual environments (happen to be using PythonBrew) in order to conquer the No Module named pysqlite2 error.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to RightBrain

Recent Posts


Recent Comments