Skip to Content

Ubuntu Python virtual environments pitfalls

I always face several pitfalls, while creating isolated python environment on my laptop, where i’m running Ubuntu.

So decided to make a memory note how to fight them, probably it can be helpful to anyone else.

pysqlite build error

If you receive an error message like this:

src/connection.h:33: fatal error: sqlite3.h: No such file or directory

It means you have no sqlite3 library development files. Solution is:

$ sudo apt-get install libsqlite3-dev

lxml build error

fatal error: libxml/xmlversion.h: No such file or directory

Means you have no libxml2 and/or libxslt development files. So just install them:

$ sudo apt-get install libxml2-dev libxslt1-dev

psycopg2 build error

Error: pg_config executable not found.

Install libpq-dev package to solve it:

$ sudo apt-get install libpq-dev

I will update this post every time I face a pitfall I have to remember about.