Como posso remover um pacote completamente?

1

Não consigo remover o pacote python3-pip no Ubuntu 16.04:

$ apt list |& grep 'python3-pip/'
python3-pip/xenial-updates,xenial-updates 8.1.1-2ubuntu0.4 all
$ sudo apt-get remove python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'python3-pip' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
openstack@prclnx04:~/python/pybind11$ apt list |& grep 'python3-pip/'
python3-pip/xenial-updates,xenial-updates 8.1.1-2ubuntu0.4 all
$ sudo dpkg --remove --force-remove-reinstreq python3-pip
dpkg: warning: ignoring request to remove python3-pip which isn't installed
$ sudo dpkg --remove --force-remove-reinstreq python3-pip
dpkg: warning: ignoring request to remove python3-pip which isn't installed
$ sudo apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu trusty InRelease
Hit:2 http://ppa.launchpad.net/diesch/testing/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu trusty Release
Hit:4 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease
Hit:6 http://archive.linux.duke.edu/ubuntu xenial InRelease
Hit:7 http://archive.linux.duke.edu/ubuntu xenial-updates InRelease
Hit:8 http://archive.linux.duke.edu/ubuntu xenial-backports InRelease
Hit:9 http://archive.linux.duke.edu/ubuntu xenial-security InRelease
Reading package lists... Done
$ apt list |& grep 'python3-pip/'           
python3-pip/xenial-updates,xenial-updates 8.1.1-2ubuntu0.4 all
$ sudo apt-get clean && sudo apt-get autoclean && sudo apt-get autoremove --purge python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'python3-pip' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ apt list |& grep 'python3-pip/'           
python3-pip/xenial-updates,xenial-updates 8.1.1-2ubuntu0.4 all

Existe uma maneira de forçar o apt a remover completamente o pacote?

Editar 1:

$ apt policy python3-pip
python3-pip:
  Installed: (none)
  Candidate: 8.1.1-2ubuntu0.4
  Version table:
     8.1.1-2ubuntu0.4 500
        500 http://archive.linux.duke.edu/ubuntu xenial-updates/universe amd64 Packages
        500 http://archive.linux.duke.edu/ubuntu xenial-updates/universe i386 Packages
     8.1.1-2 500
        500 http://archive.linux.duke.edu/ubuntu xenial/universe amd64 Packages
        500 http://archive.linux.duke.edu/ubuntu xenial/universe i386 Packages
     1.5.4-1 500
        500 http://archive.ubuntu.com/ubuntu trusty/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu trusty/universe i386 Packages
$ apt list |& grep 'python3-pip/'
python3-pip/xenial-updates,xenial-updates 8.1.1-2ubuntu0.4 all
$

$ apt list --installed | grep python3-pip

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

$ dpkg --get-selections | grep python3-pip
$ apt list |& grep 'python3-pip/'
python3-pip/xenial-updates,xenial-updates 8.1.1-2ubuntu0.4 all
$
    
por boardrider 01.03.2017 / 15:20

1 resposta

5

Primeiro, verifique se o pacote está instalado:

$ apt policy python3-pip
python3-pip:
  Installed: (none)
  Candidate: 8.1.2-2ubuntu0.1
  Version table:
     8.1.2-2ubuntu0.1 500
        500 http://archive.ubuntu.com/ubuntu yakkety-updates/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu yakkety-updates/universe i386 Packages
     8.1.2-2 500
        500 http://archive.ubuntu.com/ubuntu yakkety/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu yakkety/universe i386 Packages  

Caso seja (neste exemplo não é) execute:

sudo apt purge python3-pip  

Caso você tenha escolhido por engano o errado:

dpkg --get-selections | grep python3  

Você obtém uma lista dos pacotes python3 instalados.

Esclarecimento e informações gerais: Sua saída Editar 1 mostra que o pacote não está instalado e, portanto, não pode ser removido. O comando apt list mostra pacotes disponíveis, ele NÃO mostra pacotes instalados, a menos que você adicione --installed ao comando apt list como mencionado no comentário de @Terrance. E tenha muito cuidado com os pacotes que você remove, como apontado por @ByteCommander ... sudo apt purge remove completamente pacotes e arquivos de configuração!

    
por cl-netbox 01.03.2017 / 15:28