Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CoolCold/99dbad82f5b55cc09cbb98e6a82a3911 to your computer and use it in GitHub Desktop.
Save CoolCold/99dbad82f5b55cc09cbb98e6a82a3911 to your computer and use it in GitHub Desktop.
building python on Ubuntu 22.04 (for older/newer may need a bit of adaption) - usage pattern with asdf (building manually should be fine too)

Problem definition

so, you are using asdf for multiple Python versions and when building it (i.e. asdf install python 3.8.13 ), it gives you warnings:

WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python curses extension was not compiled. Missing the ncurses lib?
WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
WARNING: The Python lzma extension was not compiled. Missing the lzma lib?

means your system administrator have not installed dev packages (those containing headers) for such build to succeed

solution

Let's cheat and skip reading docs on library dependencies and take list of dev related packages from Build-Depends field of Ubuntu itself:

for me, list looks like:

apt-get install libbz2-dev libffi-dev libncursesw5-dev libreadline-dev libsqlite3-dev liblzma-dev  libssl-dev 

and restart the build again

asdf uninstall python 3.8.13; asdf install python 3.8.13

double checking ourselves

🕙[ 16:08:43 ] ❯ asdf uninstall python 3.8.13; asdf install python 3.8.13
No such version
python-build 3.8.13 /home/coolcold/.asdf/installs/python/3.8.13
Downloading Python-3.8.13.tar.xz...
-> https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tar.xz
Installing Python-3.8.13...
Installed Python-3.8.13 to /home/coolcold/.asdf/installs/python/3.8.13

Hooray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment