How to install python3-pip on ubuntu 20.04

25,001

Solution 1

Try this command

sudo apt-get install python3-pip

Note: If you have a fresh install, you need to do this first before trying the above command.

sudo apt-get update

Solution 2

Try the following commands:

sudo apt-get install python3-setuptools
sudo python3 -m easy_install install pip
python3 -m pip --version

Solution 3

It means you have a fresh install.

try this:

sudo apt-get update 

Then just use the below commands, it works fine.

sudo apt-get install python3-setuptools
sudo python3 -m easy_install install pip
python3 -m pip --version

Solution 4

You need to enable the universe repository to install the official package for this.

$ sudo add-apt-repository universe
$ sudo apt-get install python3-pip

Solution 5

I faced the same problem on the AWS EC2. A simple sudo apt update solved the problem.

Share:
25,001
Biochem
Author by

Biochem

Updated on July 09, 2022

Comments

  • Biochem
    Biochem almost 2 years

    I installed Ubuntu 20.04 on a PC. I then tried to get started and install pip for python3. However nothing seemed to work. This is what I have tried so far:

    sudo apt install python3-pip
    

    This is the error I get:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package python3-pip is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'python3-pip' has no installation candidate
    

    I have tried the solution proposed by Carlos Sanchez JR.: How to install Python package installer PIP on Ubuntu 20.04 Linux

    After following the advice given in the link above I got this error when doing sudo apt update :

    Ign:1 cdrom://Ubuntu 20.04 LTS _Focal Fossa_ - Release amd64 (20200423) focal InRelease
    Hit:2 cdrom://Ubuntu 20.04 LTS _Focal Fossa_ - Release amd64 (20200423) focal Release
    Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease              
    Hit:6 http://archive.ubuntu.com/ubuntu focal InRelease                        
    Get:5 http://kali.download/kali kali-rolling InRelease [30.5 kB]
    Hit:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease
    Err:5 http://kali.download/kali kali-rolling InRelease
      The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
    Get:8 http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease [30.5 kB]
    Err:8 http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease
      The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
    Reading package lists... Done
    W: GPG error: http://kali.download/kali kali-rolling InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
    E: The repository 'http://http.kali.org/kali kali-rolling InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
    E: The repository 'http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    

    Trying sudo apt install python3-pip at this point just gives me the same E: Package 'python3-pip' has no installation candidate error as before.

    I have found no other solutions to this problem.

  • Biochem
    Biochem almost 4 years
    I tried this. It gave me an error. I ended up just installing another version of Ubuntu instead. Now it works just fine.
  • Biochem
    Biochem almost 4 years
    I tried this. It gave me an error. I ended up just installing another version of Ubuntu instead. Now it works just fine.
  • Biochem
    Biochem almost 4 years
    If you read the full question (and links provided) you will see it is one of the things I tried. Looking back I think it was probably some sort of hardware problem.
  • Stonecraft
    Stonecraft over 3 years
    That fixed it for me. I had already run update, but I guess I needed to run it again.
  • Nathan Griffiths
    Nathan Griffiths about 3 years
    sudo apt update fixed it for me on a new Ubuntu Server 20.04 instance on AWS.
  • Sam
    Sam about 3 years
    this is the only way on a live cd. apt update has nothing at cdrom://... and python3-pip is not ready yet. But setuptools and easy_install can bring pip3 to work
  • Daniel
    Daniel over 2 years
    This worked for me.