WARNING: IPython History requires SQLite, your history will not be saved

You should rebuild your python with sqlite support

sudo apt-get install libsqlite3-dev
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar -xvf Python-2.7.15.tgz
cd Python-2.7.15
./configure
make
sudo make install

Recreate your virtual environment and you should be good to go

rmvirtualenv venv
mkvirtualenv -p python2 venv
workon venv
pip install -r requirements.txt
# or
pip install ipython

Thanks to minrk for pointing me in the right direction. All I had to do was rebuild python. I've outlined the steps below for those that are using pythonbrew. Notice that I already installed the libsqlite3-dev package up in the question section.

First, with the proper version of python and virtual environment loaded up run the command:

$ pip freeze -l > requirements.txt

This gives us a text file list of all of the pip packages that have been installed in the virtual environment for this particular python release in pythonbrew. Then we remove the version of python from pythonbrew and reinstall it (this is the "rebuild python" step):

$ pythonbrew uninstall 2.7.3
$ pythonbrew install 2.7.3

After that, we switch over to the newly installed python version 2.7.3 and create a new virtual environment (which I've called "sci"):

$ pythonbrew switch 2.7.3
$ pythonbrew venv create sci
$ pythonbrew venv use sci

Ideally you should be able to run the command:

$ pip install -r requirements.txt

and according to this pip should reinstall all the modules that you had in the virtual environment before we clobbered that version of python (2.7.3). It didn't work for me for whatever reason so I manually installed all of the modules using pip individuality.

$ ipython --pylab

Python 2.7.3 (default, Jan  5 2013, 18:48:27) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

and IPython history works!


I've also read in a few places that I may have to rebuild Python.

This is correct. SQLite is part of the standard library, and is built when you compile Python. There are a few 'optional' parts of the standard library, which Python will simply skip (with minimal warning, unfortunately) if the dependencies are missing at build time, and sqlite is one of these. You should be able to just install libsqlite3-dev, then rebuild Python and you should be set. Keep an eye on the build messages, as they do report which modules they are skipping due to missing dependencies.


What worked for me (using osx + homebrew + brewed python):

# Reinstall Python 2.7 with sqlite
brew remove python
brew install readline sqlite gdbm --universal
brew install python --universal --framework

# Reinstall iPython with correct bindings
pip uninstall ipython    
pip install ipython

And you should be good to go.