Install PIP for Python 3 in CentOS 8
If you’ve ever tried to drop a pip install command on a fresh CentOS 8 box and hit a wall, you’re not alone. The default repositories don’t ship a ready‑to‑go pip binary for Python 3, so a quick setup is worth the time.
Why you’ll need this
I’ve seen developers boot up new servers, type pip install requests, and get an error that says “No module named pip”. That’s because CentOS 8 ships with Python 2.7 by default, and its pip package isn’t automatically installed for Python 3. Once you have pip working, installing any third‑party library becomes a one‑liner.
Step 1: Update the system
sudo dnf update -y
Doing this first keeps your packages from pulling in old dependencies that could break later installs.
Step 2: Enable EPEL (Extra Packages for Enterprise Linux)
The official CentOS repos don’t contain python3-pip. The EPEL repository does, so add it:
sudo dnf install epel-release -y
If you already have EPEL enabled, this command just bumps the package to the latest version.
Step 3: Install Python 3
CentOS 8 comes with a python36 package in the base repo. Installing it gives you both the interpreter and the ensurepip module:
sudo dnf install python36 -y
After that, verify the binary exists:
python3.6 --version # should print 3.6.x
Step 4: Pull in pip for Python 3
Now you can install the pip package from EPEL:
sudo dnf install python36-pip -y
If you prefer to bootstrap pip yourself, use ensurepip instead:
python3.6 -m ensurepip --upgrade
Either way, check that pip3 is now in your path:
pip3 --version # should show something like 20.x or newer
Step 5: Upgrade pip (optional but recommended)
The version shipped with the distribution might be a few releases behind. Upgrading ensures you get the latest features and security fixes:
sudo pip3 install --upgrade pip
If you’re running into permission errors, add --user or run with sudo.
Common pitfalls
- “No matching package” error – Make sure EPEL is enabled before installing python36-pip. The base repo doesn’t have it.
- Python 2 vs Python 3 confusion – On CentOS 8 the command pip still points to pip for Python 2. Use pip3 or python3 -m pip when you mean the new interpreter.
Quick sanity check
# Install a lightweight package to prove it works sudo pip3 install tqdm
If that installs without complaints, you’re good to go.