SEO

The error is simply a typo (and a deprecated package name). To install pip on a modern Debian/Ubuntu system, first update your package lists and then install the python3-pip package:

sudo apt update
sudo apt install python3-pip

After that, verify it’s working:

pip3 --version
# e.g. pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.10)

If for some reason you really need Python 2’s pip (not recommended, since Python 2 is end-of-life), you can install:

sudo apt install python2-pip

But in almost all cases today you’ll want python3-pip.

Because if you’re on a Debian/Ubuntu system with PEP 668 “externally managed” Python, you have two clean options:


1) Install the Debian-packaged libraries system-wide

sudo apt update
sudo apt install python3-requests python3-bs4

These give you the same requests and bs4 modules without touching pip3. (You already have python3-pip installed.)


2) Use a virtual environment

If you want full control with pip, create and activate a venv first:

sudo apt install python3-venv python3-full      # if you don’t yet have venv support
python3 -m venv ~/my-sitemap-venv
source ~/my-sitemap-venv/bin/activate
pip install requests beautifulsoup4

Now run your script inside that venv, and it can freely pip install whatever you need.


Either approach will let you run the sitemap-generation script without the “externally-managed-environment” error.