-1

I'm on Ubuntu 19.04 and I would like to make sure that if I try to install some software with a hard Python 2 dependency that it would just fail instead of installing 2 on my system.

Boris Verkhovskiy
  • 3,134
  • 3
  • 30
  • 39

1 Answers1

2

Use apt-mark:

See the apt-mark manpage:

PREVENT CHANGES FOR A PACKAGE

hold

hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed.

Try:

sudo apt-mark hold python

Note that this is a Really Bad Idea on Ubuntu 16.04 and earlier, as Python 2 is an essential part of those releases.

user535733
  • 58,040
  • 10
  • 106
  • 136
  • Pinning is [more reliable](https://askubuntu.com/a/1002760/66509). – N0rbert May 09 '19 at 18:01
  • This didn't work for me because other things need to be pinned, not just python 2. I made a list here but it's probably incomplete https://askubuntu.com/questions/320996/how-to-make-python-program-command-execute-python-3/1031733#1031733 – Boris Verkhovskiy Dec 22 '20 at 18:27