After consulting gemini.google.com, I ran this: sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.11 I received message: python3.11 is already the latest version (3.11.9-1+jammy1) however: python3 --version returns: Python 3.10.12 Answer from neil on discuss.python.org
🌐
Python.org
discuss.python.org › python help
Install python 3.11.9 on ubuntu - Python Help - Discussions on Python.org
I have installed guest VM ubuntu-22.04.4-desktop-amd64.iso on a Windows 10 host. In the VM, I have run the following: sudo apt install sudo apt upgrade this: python3 --version returns: Python 3.10.12 When I run: sudo apt install python3 I receive this message: python3 is already at the newest ...
Published   April 16, 2024
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › starting › install3 › linux
Installing Python 3 on Linux — The Hitchhiker's Guide to Python
$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.8
Discussions

python 3.x - Ansible - install python3-apt package - Stack Overflow
Using Ubuntu 18.04, Ansible 2.9, Python 3.6.9, have installed python3-apt On a basic ansible command ansible -b all -m apt -a "name=apache2 state=latest" Get Error: FAILED! => { &q... More on stackoverflow.com
🌐 stackoverflow.com
python3 - Difference between installing a package with 'apt' and 'pip' - Unix & Linux Stack Exchange
I have been trying to install a Python module which relies in setuptools, and apparently the module was installed using apt. However, it seems to be the wrong version, so I tried to install it usin... More on unix.stackexchange.com
🌐 unix.stackexchange.com
February 8, 2023
How to install a package using the python-apt API - Stack Overflow
I'm quite a newbie when it comes to Python, thus I beg foregiveness beforehand :). That said, I'm trying to make a script that, among other things, installs some Linux packages. First I tried to use More on stackoverflow.com
🌐 stackoverflow.com
python - How to install python3 version of package via pip on Ubuntu? - Stack Overflow
Following @LennartRegebro and @user2503795, I can confirm that this is a bit more robust: virtualenv -p `which python3` py3env 2016-03-18T23:37:42.883Z+00:00 ... The short answer applies only on newer systems. On some versions of Ubuntu the command is pip-3.2: ... sudo apt-get install curl ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Reddit
reddit.com › r/ansible › python3-apt?
r/ansible on Reddit: Python3-apt?
October 14, 2022 -

Hello all ansiblians,

Does anyone know what is python3-apt used for?

I just upgraded from Python3.6 to Python3.10 with deadsnake ppa on a Ubuntu 18 box. After that I am no longer able to use Ansible apt module to remotely install packages. With -vvv this is all I got -

"python3-apt must be installed and visible from /usr/bin/python3"

I have reinstalled python3-apt but Ansible controller remains angry and complaining with this error.

Any thoughts? K.

🌐
Debian
packages.debian.org › python3-apt
Debian -- Package Search Results -- python3-apt
sid (unstable) (debug): debug symbols for python3-apt 3.1.0 [debports]: alpha hppa loong64 m68k ppc64 sh4 sparc64 x32 2.8.0 [debports]: ia64 2.6.0 [debports]: riscv64
🌐
Ubuntu
launchpad.net › ubuntu › jammy › +package › python3-apt
python3-apt : Jammy (22.04) : Ubuntu - Launchpad
python3-apt · The apt_pkg Python 3 interface will provide full access to the internal libapt-pkg structures allowing Python 3 programs to easily perform a variety of functions, such as: . - Access to the APT configuration system - Access to ...
🌐
Pkgs.org
pkgs.org › download › python3-apt
Python3-apt Download for Linux (deb rpm)
Download python3-apt linux packages for Debian, Fedora, Ubuntu
Find elsewhere
🌐
BitLaunch
bitlaunch.io › blog › how-to-install-python-on-ubuntu
7 Ways to Install and Manage Python and Python3 on Ubuntu
December 17, 2025 - In all likelihood, you'll want to install tools like pip and venv alongside Python to help manage and your versions and virtual environments. To update and install Python, pip, and venv, you can run these commands instead: sudo apt update sudo apt ...
🌐
Debian
packages.debian.org › sid › python3-apt
Debian -- Details of package python3-apt in sid
The included 'aptsources' Python interface provides an abstraction of the sources.list configuration on the repository and the distro level.
🌐
Debian
apt-team.pages.debian.net › python-apt › contents.html
Python APT Documentation contents — python-apt 3.1.0 documentation
What’s new in python-apt · What’s New In python-apt 0.7.100 · Support for Python 3 · Real classes in apt_pkg · Complete rename of functions, methods and attributes · Context managers for the with statement · Unification of dependency handling · C++ headers ·
🌐
Ubuntu
launchpad.net › ubuntu › +source › python-apt
python-apt package : Ubuntu - Launchpad
python-apt-common: Python interface to libapt-pkg (locales) python-apt-dev: Python interface to libapt-pkg (development files) python-apt-doc: Python interface to libapt-pkg (API documentation) python3-apt: Python 3 interface to libapt-pkg python3-apt-dbgsym: debug symbols for python3-apt
🌐
Debian
packages.debian.org › buster › python3-apt
Details of package python3-apt in buster
two or more packages specified (python3-apt buster) See our contact page to get in touch. Content Copyright © 1997 - 2025 SPI Inc.; See license terms. Debian is a trademark of SPI Inc. Learn more about this site.
🌐
Ubuntu
packages.ubuntu.com › focal › python3-apt
Details of package python3-apt in focal
December 9, 2020 - two or more packages specified (python3-apt focal) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
GitHub
gist.github.com › rutcreate › c0041e842f858ceb455b748809763ddb
Install Python 3.10.x on Ubuntu 20.04 · GitHub
$ sudo add-apt-repository ppa:deadsnakes/ppa [sudo] password for dev: Traceback (most recent call last): File "/usr/bin/add-apt-repository", line 12, in <module> from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 68, in <module> from gi.repository import Gio File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module> from .
Top answer
1 of 2
23

I will appreciate if someone could explain the differences (if any) between:

Highest level: you never should use pip install to install to system (--system, or on Linux distros where --user isn't the default, omitting --user) when things might conflict with your system whereas apt install is pretty safe.

Explanation:

apt is the package installation tool of your Linux distro. A Linux distribution these days is mostly the effort to offer a way to install packages in a way that works with each other without breaking – for example, if you're trying to install a library that libreoffice uses, but in a version incompatible with your libreoffice, your linux distro tool will tell you that sadly, to fulfill your command, it will have to uninstall libreoffice, because it wouldn't work with that version you're requesting.

The fact that you very rarely see that happen is an indication of how well modern Linux distros are doing here: typically, most of software that you can install using apt works well together.

pip, on the other hand, has no notion of what other software you have on your machine, which you might need. You tell pip to install something in a version that breaks your ability to even boot your system – it will go ahead and do that.

pip is python-specific. It assumes that all there is on that machine that has something to do with Python is kind of "fair game" and can be dealt with arbitrarily. Frankly, that is almost never the case – for example, on Fedora (another Linux distro that you're not using), you can easily break the installation tool dnf (Fedora's apt, if you will) with pip.

So, why does pip still exist? Well, there are situation where it's OK for pip to assume every bit of python it sees is under its control: Python brings a mechanism called virtual environments. In these, no python modules are per se installed, and they don't conflict with other software on your machine – simply because other software isn't aware of the environment.

Using that is quite straightforward. You can set up such an environment using

python3 -m venv ~/bertsexperiment

That sets up a folder ~/bertsexperiment for Python stuff to be installed into. You can then, from anywhere you like, "activate" that environment (what that really does is just change a few environment variables) – but that only affects the current process and things started from it. Try it:

source ~/bertsexperiment/bin/activate

will set up this shell in a way that all future python tooling will work with that folder as "prefix".

For example, if you wanted to have an updated setuptools in that shell, you could, after sourceing the activaton script as shown above, run pip3 install --upgrade setuptools, and they would be installed into the virtualenv.

In short:

  • if in doubt, use apt, because it's your distro's job to keep your software stack working together
  • Never use pip unless you intend to install something into a folder only used for your current project and not by anything else on your system.
    Hence, the only realistic time you would want to use it is when you're using a Python virtualenv.
2 of 2
0

It really depends on your end goal.

  • Something in another Debian package depends on this package? Definitely use apt.
  • Or conversely, you want to create a package or a set of packages for Debian or a Debian-based distro like Ubuntu, Mint, etc - again, definitely stay in apt land.
  • You want to install something which requires a newer version than you can find on Debian - you can hunt for backported .deb packages from https://backports.debian.org/ or random PPAs, but perhaps at this point it's easier and more straightforward to move to pip. (Though sometimes the packaging work adds significant value but requires nontrivial effort; then, a PPA can really save your day.)
  • You want to develop a Python script of your own and ideally have the latest and greatest features of the Python packages you depend on - usually then use pip
    • ... or even install things directly from the upstream Github project or whatever, for the really bleeding edge. But probably don't stretch too far. If you don't have a professional software development team at your disposal, stick to reasonably stable versions for all but the most valuable, most crucial one or two packages you depend on.

To recap, what makes sense ultimately depends on where in the maturity cycle you are. The benefit of official Debian packages is that they tend to be very stable and time-tested, but the drawback is then that you will not be running the latest versions with the spiffiest new features.

Also keep in mind that some Debian packages go to extra lengths to integrate the packaged software with the broader Debian ecosystem. For a random Python script this is typically unimportant, but if it's a Debian system administration tool or some sort of infrastructure project, obviously you want all the Debian parts that upstream might not have, or might not enable and configure correctly by default.

🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install python 3 on ubuntu
How to Install Python 3 on Ubuntu | phoenixNAP KB
June 12, 2025 - sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
Top answer
1 of 2
87

As the package description you linked to says:

In Ubuntu, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python at all ... No packages may declare dependencies on this package.

So, all official Ubuntu packages will depend explicitly on "python2" or "python3", and invoke the appropriate command. The default "python" command is deliberately undefined so that any scripts referencing it have to be updated to unambiguously depend on one version or the other.

However, users may have code that relies on the "python" command being available, and know that they can safely point it across their whole system to one version or the other. The python-is-python3 package (and its counterpart, python-is-python2) are a convenient way to set up a symlink for this purpose.

Does python-is-python3 really just create a single symlink? It seems odd to introduce a package for such a bare bones purpose.

Linux distributions are extremely complex systems made up of a large number of simple components. The power of package managers comes in their flexibility to do simple things like this in a unified way. For instance, a server setup script might have a long list of apt packages that an application needs to be installed, and can simply include python-is-python3 in that list. Shipping a package for this purpose is considerably simpler than having a user guide explaining how to manage the symlink manually.

Does the same go for pip, i.e. pip instead of pip3?

Apparently not - according to this LaunchPad bug, the python3 package automatically points pip at pip3 anyway.

If you open up the .deb file for the package (I used 7-Zip), you can see that apart from some documentation, it really does just contain one symlink, to be installed at /usr/bin/python, pointing to /usr/bin/python3.

2 of 2
28

In Ubuntu, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python at all. Some third-party code is now predominantly python3 based, yet may use /usr/bin/python.

python-is-python3 is a convenience package which ships a symlink to point the /usr/bin/python interpreter at the current default python3. It may improve compatibility with other modern systems, while breaking some obsolete or third-party software.

python-is-python3 replaces: python, python-is-python2.

I installed python-is-python3 as a convenience package in Ubuntu 20.04, but I later uninstalled it after python2.7 was automatically installed as a dependency of another package.