Notes du 2018-09-20
2018-11-10: update source:
debian-facile.org/doc:systeme:apt:pinning
2019-03-24: Ajouter la doc du wiki debian :
https://wiki.debian-fr.xyz/L%27etiquetage_de_paquets_via_le_fichier_/etc/apt/preferences
En version stable, on a pas les dernière version des logiciels.
C'est très gênant quand, par exemple, on veut utiliser Python 3.6 sur un système Debian stable.
Pour rester conforme au packaging Debian, on ajout un canal dans APT sourcelist qui pointe vers la distribution Debian testing.
# vi /etc/apt/sources.list # Dépôt d'origine deb http://ftp.debian.org/debian/ stretch main deb http://security.debian.org/ stretch/updates main # Ajout du dépôt Testing deb http://ftp.de.debian.org/debian testing main
Pour rendre les dépôt Stable en priorité, il faut exécuter :
# echo 'APT::Default-Release "stable";' | sudo tee -a /etc/apt/apt.conf.d/00local
Prise en compte du dépôt testing
# sudo apt-get update
Reprenons l'exemple de Python3.6 non dispo en stable, il suffit de préciser à APT qu'il faut utiliser le dépôt testing avec l'option -t testing :
# sudo apt-get -t testing install python3.6
# python3.6 Python 3.6.6 (default, Jun 27 2018, 14:44:17) [GCC 8.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
Même démarche pour pip3:
# apt-get -t testing install python3-pip
Test de pip3:
# pip3 install tabulate
Collecting tabulate
Installing collected packages: tabulate
Successfully installed tabulate-0.8.2
Test de la lib tabulate dans Python 3.6 pour être certain que Pip sur bien pour Python 3 et non pas Python 2:
# python3.6 Python 3.6.6 (default, Jun 27 2018, 14:44:17) [GCC 8.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tabulate >>> table = [["spam",42],["eggs",451],["bacon",0]] >>> headers = ["item", "qty"] >>> print(tabulate.tabulate(table, headers, tablefmt="fancy_grid")) ╒════════╤═══════╕ │ item │ qty │ ╞════════╪═══════╡ │ spam │ 42 │ ├────────┼───────┤ │ eggs │ 451 │ ├────────┼───────┤ │ bacon │ 0 │ ╘════════╧═══════╛
Pas d'erreur coté Python3.6 et installation de Pip3, donc tout va bien !!
J'observe une certaine étanchéité entre Python 3.5 d'origine et ne nouveau Python 3.6. Ce qui m'arrange bien.
Réalisons le même test que précédemment, mais avec Python 3.5 :
# python3.5 Python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tabulate Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'tabulate'
Python 3.5 rejette l'import de 'tabulate' donc 'n'est pas impacté par l'installation de cette lib avec pip3.
Pour l'instant, ceci évite d'utiliser Virtualenv et simplifie l'installation de Django en attend la montée de version de Python 3 dans la prochaîne version stable de Debian.
Thanks for reading !!