11

Tried -

sudo apt update

sudo apt-get install python3-setuptools

giving error -

E: Package 'python3-setuptools' has no installation candidate

Tried -

sudo apt update

sudo apt install python3-pip

giving error -

E: Package 'python3-pip' has no installation candidate

When checked for universal repository -

sudo add-apt-repository universe

'universe' distribution component is already enabled for all sources.

For any other command too, giving error as python3-packagename has no installation candidate.

I checked the version of python, it is 3.8.2 . I installed 3.9 now and how to make it default. I want to try it so that whether it may works.

N0rbert
  • 99,918
  • 1
    Please edit your question to show us the complete output of sudo apt update – user535733 Jun 27 '20 at 14:08
  • Try this question on Stack Overflow https://stackoverflow.com/questions/52394543/pip-install-problem-with-ubuntu-18-04-and-python-3-6-5 and this https://stackoverflow.com/questions/55422929/e-unable-to-locate-package-python-pip-on-ubuntu-18-04 or this https://stackoverflow.com/questions/44296498/unable-to-install-pip-in-ubuntu/44296569 – Yeppii Jun 27 '20 at 15:17

1 Answers1

13

Run

sudo nano /etc/apt/sources.list

And add these lines.

deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe 
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe

Press Ctrl+O to save the file. Press Ctrl+X to quit nano.

Then run:

sudo apt update
sudo apt install python3-pip

This works.
I also works with

apt update
apt upgrade
zx485
  • 2,426
  • You should generally refrain from using other release's repositories. This may sometimes lead to dependency issues with other packages and may make your system to receive updates that are originally intended for bionic. The packages you mentioned are there in focal as well. Consider restoring Focal's repositories and try again. python3-pip is In Universe and python3-setuptools is in main. If still you can't get those packages, consider editing question and adding the output of cat /etc/apt/sources.list and apt-cache policy python3-pip python3-setuptools. – Kulfy Jun 27 '20 at 16:12
  • 6
    sudo apt update and sudo apt install python3-pip is enough – Talha Anwar Apr 20 '21 at 12:07
  • The below preceding example is working
    sudo apt update and sudo apt install python3-pip Thanks a Ton @Kulfy
    – thrinadhn Aug 21 '21 at 06:21