I've been trying to adopt pyenv for a few months, but have been completely blocked by this issue on one of the main machines I use. Whenever I start up ipython I get the following error.

ImportError: No module named '_sqlite3

I talked about why and how to use pyenv along with my first impressions in this post


According to #678 I need to install libsqlite3-dev on ubuntu to resolve this issue.

install libsqlite3-dev

libsqlite3-dev can be installed using apt

sudo apt install libsqlite3-dev

But wait....

When I make a fresh env and install ipython I still get the same error and I am still not able to use ipython with pyenv.

ImportError: No module named '_sqlite3

re-install python

After having this issue for awhile an coming back to #678 several times I realized that libsqlite3-dev needs to be installed while during install.

pyenv install 3.8.13

I think I had tried this several times, but was missing the -y option each time. You gotta read errors like this, I am really good at glossing over them.


Let's never have this issue again.

When you spend months living with little errors like this and finally fix it, its good to make sure that it never happens again. Whenever I start a new ubuntu machine I run an ansible playbook that does all the setup for me. I added libsqlite3-dev to my core install in 64c85ca now it will be on all of my machines and not break again.