Ubuntu 26.04 225 's python3 is Python 3.14, and Ubuntu marks its system Python as externally managed: pip 21,050 install outside a virtual environment is refused, so that pip cannot break packages the operating system depends on. A virtual environment (venv) is a private folder with its own site-packages. Create one for this book and install the libraries this chapter needs, pinned to the versions the book was tested with:
sudo apt-get install -y -qq python3-venv python3-pip # once per machine
python3 -m venv ~/de-venv # create the environment
source ~/de-venv/bin/activate # use it in this shell
pip install --quiet duckdb==1.5.5 pyarrow==25.0.1 matplotlib==3.11.2
pip freeze > ~/requirements.txt # record exact versions
python --version && grep -E "duckdb|pyarrow|matplotlib|numpy" ~/requirements.txtPython 3.14.4 duckdb==1.5.5 matplotlib==3.11.2 numpy==2.5.3 pyarrow==25.0.1
pip freeze recorded numpy too, although you never asked for it: matplotlib depends on it. The frozen file pins every transitive dependency, so pip install -r requirements.txt rebuilds the same environment next month or on a colleague's machine. Later chapters add packages (lxml 3,063 in XML and Its Toolchain, dbt 37,942 in Analytical SQL and Data Warehouses, PySpark 129 in Batch Processing with Apache Spark) to the same environment.