Python build dependencies on Debian

On a fresh Debian 10 (buster) I am building Python-3.9-4 from source. Missing OS libraries cause a partial build. e.g.:

Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().                                

The output suggests:

The necessary bits to build these optional modules were not found:                                                            
_bz2                  _curses               _curses_panel                                                                     
_dbm                  _gdbm                 _hashlib                                                                          
_lzma                 _sqlite3              _ssl                                                                              
_tkinter              _uuid                 readline                                                                          
zlib                                                                                                                          
To find the necessary bits, look in setup.py in detect_modules() for the module's name.                                       

but… is a list of Debian packages to install to complete the build available anywhere? I was able to figure out what I needed from the above but it seems logical for this info to be easily found. Maybe I overlooked it?

The CI uses .github/workflows/posix-deps-apt.sh to install dependencies. That should cover most of them.

$ cat .github/workflows/posix-deps-apt.sh 
#!/bin/sh
apt-get update

apt-get -yq install \
    build-essential \
    gdb \
    lcov \
    libbz2-dev \
    libffi-dev \
    libgdbm-dev \
    liblzma-dev \
    libncurses5-dev \
    libreadline6-dev \
    libsqlite3-dev \
    libssl-dev \
    lzma \
    lzma-dev \
    tk-dev \
    uuid-dev \
    xvfb \
    zlib1g-dev
2 Likes

Oh, I see that the dev guide also has a section about Linux dependencies.

1 Like

I had seen and followed that guide but for Debian it only suggests: sudo apt-get build-dep python3.x which is not sufficient.

Yeah, I guess that should be updated. The macOS section is a little bit out of date as well.

Yeah, I guess that should be updated. The macOS section is a little bit out
of date as well.

By the way, that list you shared is already 95% there as it got me all modules
bar dbm, which I did not want anyway. Thank you.

1 Like

Glad to help!

BTW, the .github directory lies at the root of the repo, so if you’ve git cloned CPython, you already got it. Don’t know if it’s included in the source tarball though.

Yeah, I guess that should be updated. The macOS section is a little bit out
of date as well.

1 Like