pyenv build depencies on Ubuntu

pyenv can get particularly annoying during building Python. Dependencies are often missing resulting in failed builds. This short blog post is outlining the required dependencies to reduce headaches for future me, and anyone else reading this.

You have probably come here seeing errors like:

zipimport.ZipImportError: can't decompress data; zlib not available
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Well, just install these and you’ll be good to go.

$ sudo apt-get build-dep python3
$ sudo apt-get install libreadline-dev libsqlite3-dev bz2-dev libssl-dev zlib1g-dev libffi-dev

You’re welcome.

Simple Python Profiling with IPython

Profiling is imperative to understand your application. However, getting started with profiling might seem to be a steep learning curve; but it doesn’t have to be! IPython has a lot of built-in magic commands, and some of them are helpful to profile your Python code. %timeit and %prun are among the ones I found most useful. Continue reading Simple Python Profiling with IPython