25

I have ubuntu version 20.04 and I would like to install python 3.6 from the shell. After sudo apt install software-properties-common I am trying to use the add-apt-repository ppa:deadsnakes/ppa command but I am getting this error:

Cannot add PPA: 'ppa:~deadsnakes/ubuntu/ppa'.
ERROR: '~deadsnakes' user or team does not exist

Did I forget any steps or does the repository no longer work?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
nenno lillo
  • 537
  • 1
  • 4
  • 12
  • 1
    hmm, are you sure you need that `~` character in front of the team name? Maybe I'm missing some syntax detail there, but `sudo add-apt-repository ppa:deadsnakes/ppa` is what's recommended [here](https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa) – kuropan Mar 12 '21 at 10:14
  • 2
    @kuropan I'm running into the same issue, and I'm not adding the `~`, it's added by the add-apt-repository command. – CodeMonkey May 20 '21 at 11:28

7 Answers7

23

You're probably behind a corporate proxy and to add -E to your sudo command to preserve the environment variables.

$ sudo add-apt-repository -y 'ppa:deadsnakes/ppa'
Cannot add PPA: 'ppa:~deadsnakes/ubuntu/ppa'.
ERROR: '~deadsnakes' user or team does not exist.
$ sudo -E add-apt-repository -y 'ppa:deadsnakes/ppa'
 This PPA contains more recent Python versions packaged for Ubuntu.

Disclaimer: there's no guarantee of timely updates in case of security problems or other issues. If you want to use them in a security-or-otherwise-critical environment (say, on a production server), you do so at your own risk.

Update Note
===========
...
vvvvv
  • 25,404
  • 19
  • 49
  • 81
CodeMonkey
  • 4,067
  • 1
  • 31
  • 43
  • 1
    If you're on WSL, and this doesn't fix it: Make sure you're not behind a proxy; make sure WSL can connect to anything at all (`ping 8.8.8.8`), if not, restart WSL (in powershell: `wsl --shutdown`). – Nearoo Nov 17 '21 at 10:58
13

I got this error with a fresh Ubuntu installation in a VM and none of the other answers worked for me. However, this command solved the problem for me:

sudo apt-get install --reinstall ca-certificates

(Credits: this was answered here at a related question.)

wovano
  • 4,543
  • 5
  • 22
  • 49
11

For people having issues running this within a Dockerfile, changing:

RUN add-apt-repository ppa:deadsnakes/ppa

to:

RUN add-apt-repository 'ppa:deadsnakes/ppa'

Fixed the problem for me.

Shaman
  • 113
  • 1
  • 9
3

Just type this before running ppa command:

sudo apt install software-properties-common -y
Matteo Toma
  • 562
  • 5
  • 12
2

I had the same problem, but was on a Docker container, so no sudo was avilable. I was able to manually add the repository at /etc/apt/sources.list:

deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu YOUR_UBUNTU_VERSION_HERE main

I was on 16.04, so used xenial.

then:

apt-key adv --keyserver keyserver.ubuntu.com/ --recv-keys BA6932366A755776

You should be able to install python 3.6 with

apt-get install python3.6
wjandrea
  • 28,235
  • 9
  • 60
  • 81
Aatlantise
  • 36
  • 1
  • 4
2

Did you check the existence of /etc/apt/sources.list.d? After messing around with my ppa, I found that I had not created that directory. If this is also your case, please do

$ sudo mkdir /etc/apt/sources.list.d
$ sudo add-apt-repository ppa:deadsnakes/ppa

also, as @kuropan suggested, there is no need for add the ~ before 'deadsnakes'

I'm using ubuntu 20.04.1 LTS

vvvvv
  • 25,404
  • 19
  • 49
  • 81
0

Do you copy this command from a certain web page? Maybe there are some invisible character in it. Try to enter it manually.

tinyhare
  • 2,271
  • 21
  • 25