Installing Python 3.7-3.9 on Ubuntu 22.04 Jammy LTS using PPA

How can we help?
< All Topics
Print

Installing Python 3.7-3.9 on Ubuntu 22.04 Jammy LTS using PPA

Canonical recently announces the general availability of Ubuntu 22.04 Jammy Jellyfish LTS on April 21, 2022. Jammy has Python 3.10 installed already. Indeed, you can install more versions via the upstream repository but it only provides Python 2.7 and Python 3.10 modules. In this article, I will show you how to install Python 3.7 up to 3.9

TLDR

sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install python3.8

Installing Python

First of all, you’ll need the following package installed so we can import any PPA (Personal Package Archive) repositories:

sudo apt install software-properties-common -y

Then, we will import deadsnake’s PPA:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update

You can then install previous Python versions, for example Python 3.7:

sudo apt install python3.7

The maintainer of the PPA informs that they only ship Python 3.7 as the lowest version for Jammy, so if you wish to install the more older version, you might want to install it for source.

Supported Ubuntu and Python Versions
====================================

- Ubuntu 18.04 (bionic) Python2.3 - Python 2.6, Python 3.1 - Python 3.5, Python3.7 - Python3.11
- Ubuntu 20.04 (focal) Python3.5 - Python3.7, Python3.9 - Python3.11
- Ubuntu 22.04 (jammy) Python3.7 - Python3.9, Python3.11
- Note: Python2.7 (all), Python 3.6 (bionic), Python 3.8 (focal), Python 3.10 (jammy) are not provided by deadsnakes as upstream ubuntu provides those packages.

Install PIP

The previous python installation does not provide pip by default, so you will have to do:

python3.x -m ensurepip --upgrade

Then verify it using

pip --version

Important Thing to Note

Never ever change the default python version of Ubuntu as it will break many things. Either by changing python3 symlink or using update-alternatives command.

Conclusion

To sum up the article, it is easy to install previous versions of Python on Ubuntu 22.04 Jammy LTS thanks to deadsnake team’s PPA. Hopefully you find this tutorial article helpful for your present and up coming project.

For more articles and tutorials about technology, please visit Cloud Raya’s Knowledge Base and Blog. Even better, you can video stream tutorials from Cloud Raya’s Youtube channel.

Table of Contents

4 Comments

  1. Hi, i see this error

    sudo add-apt-repository ppa:deadsnakes/ppa -y
    Traceback (most recent call last):
     File “/usr/bin/add-apt-repository”, line 364, in <module>
      sys.exit(0 if addaptrepo.main() else 1)
     File “/usr/bin/add-apt-repository”, line 347, in main
      shortcut = handler(source, **shortcut_params)
     File “/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py”, line 40, in shortcut_handler
      return handler(shortcut, **kwargs)
     File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 82, in __init__
      if self.lpppa.publish_debug_symbols:
     File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 120, in lpppa
      self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
     File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 107, in lpteam
      self._lpteam = self.lp.people(self.teamname)
     File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 98, in lp
      self._lp = login_func(“%s.%s” % (self.__module__, self.__class__.__name__),
     File “/usr/lib/python3/dist-packages/launchpadlib/launchpad.py”, line 494, in login_anonymously
      return cls(
     File “/usr/lib/python3/dist-packages/launchpadlib/launchpad.py”, line 230, in __init__
      super(Launchpad, self).__init__(
     File “/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py”, line 472, in __init__
      self._wadl = self._browser.get_wadl_application(self._root_uri)
     File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 447, in get_wadl_application
      response, content = self._request(url, media_type=wadl_type)
     File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 389, in _request
      response, content = self._request_and_retry(
     File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 359, in _request_and_retry
      response, content = self._connection.request(
     File “/usr/lib/python3/dist-packages/httplib2/__init__.py”, line 1725, in request
      (response, content) = self._request(
     File “/usr/lib/python3/dist-packages/launchpadlib/launchpad.py”, line 144, in _request
      response, content = super(LaunchpadOAuthAwareHttp, self)._request(
     File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 184, in _request
      return super(RestfulHttp, self)._request(
     File “/usr/lib/python3/dist-packages/httplib2/__init__.py”, line 1441, in _request
      (response, content) = self._conn_request(conn, request_uri, method, body, headers)
     File “/usr/lib/python3/dist-packages/httplib2/__init__.py”, line 1363, in _conn_request
      conn.connect()
     File “/usr/lib/python3/dist-packages/httplib2/__init__.py”, line 1153, in connect
      sock.connect((self.host, self.port))
     File “/usr/lib/python3/dist-packages/httplib2/socks.py”, line 504, in connect
      self.__negotiatehttp(destpair[0], destpair[1])
     File “/usr/lib/python3/dist-packages/httplib2/socks.py”, line 465, in __negotiatehttp
      raise HTTPError((statuscode, statusline[2]))
    httplib2.socks.HTTPError: (403, b’Forbidden’)

    any ideas?

  2. Você pode usar o software de gerenciamento dos pais para orientar e supervisionar o comportamento dos filhos na Internet. Com a ajuda dos 10 softwares de gerenciamento de pais mais inteligentes a seguir, você pode rastrear o histórico de chamadas de seu filho, histórico de navegação, acesso a conteúdo perigoso, aplicativos que eles instalam etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

Ready, Set, Cloud

Ready, Set, Cloud