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
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
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
๐ŸŒ
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 ...
๐ŸŒ
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 ...
Find elsewhere
๐ŸŒ
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 .
๐ŸŒ
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
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.

๐ŸŒ
Ubuntu
packages.ubuntu.com โ€บ trusty โ€บ python3-apt
Ubuntu โ€“ Error
two or more packages specified (python3-apt trusty) Content Copyright ยฉ 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.