Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am running ubuntu 20.04.01 and have recently started working with python.

One of the projects I am working on required me to install six, which is a Python 2 and 3 compatibility library.

pip show six returns me:

Name: six
Version: 1.15.0
Summary: Python 2 and 3 compatibility utilities
Home-page: https://github.com/benjaminp/six
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /home/username/.local/lib/python3.8/site-packages
Requires: 
Required-by: Represent, cycler, launchpadlib

However everytime I launch any one of the following commands: apt upgrade -y apt autoremove and so on, I get the following error:

sudo apt autoremove                                     
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
0 mis à jour, 0 nouvellement installés, 0 à enlever et 2 non mis à jour.
3 partiellement installés ou enlevés.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Paramétrage de update-notifier-common (3.192.30) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 351, in <module>
    process_download_requests()
  File "/usr/lib/update-notifier/package-data-downloader", line 250, in process_download_requests
    for para in hook.iter_paragraphs(open(file)):
  File "/usr/lib/python3/dist-packages/debian/deb822.py", line 717, in iter_paragraphs
    x = cls(iterable, fields, encoding=encoding, strict=strict)
  File "/usr/lib/python3/dist-packages/debian/deb822.py", line 632, in __init__
    self._internal_parser(iterable, fields, strict)
  File "/usr/lib/python3/dist-packages/debian/deb822.py", line 769, in _internal_parser
    if isinstance(sequence, (six.string_types, bytes)):
NameError: name 'six' is not defined
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 32, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 12, in <module>
    import os, glob, subprocess, os.path, time, pwd, sys, requests_unixsocket
  File "/usr/lib/python3/dist-packages/requests_unixsocket/__init__.py", line 1, in <module>
    import requests
  File "/usr/lib/python3/dist-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/usr/lib/python3/dist-packages/urllib3/__init__.py", line 7, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 11, in <module>
    from .exceptions import (
  File "/usr/lib/python3/dist-packages/urllib3/exceptions.py", line 2, in <module>
    from six.moves.http_client import IncompleteRead as httplib_IncompleteRead
ModuleNotFoundError: No module named 'six'
Original exception was:
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 351, in <module>
    process_download_requests()
  File "/usr/lib/update-notifier/package-data-downloader", line 250, in process_download_requests
    for para in hook.iter_paragraphs(open(file)):
  File "/usr/lib/python3/dist-packages/debian/deb822.py", line 717, in iter_paragraphs
    x = cls(iterable, fields, encoding=encoding, strict=strict)
  File "/usr/lib/python3/dist-packages/debian/deb822.py", line 632, in __init__
    self._internal_parser(iterable, fields, strict)
  File "/usr/lib/python3/dist-packages/debian/deb822.py", line 769, in _internal_parser
    if isinstance(sequence, (six.string_types, bytes)):
NameError: name 'six' is not defined
dpkg: erreur de traitement du paquet update-notifier-common (--configure) :
 installed update-notifier-common package post-installation script subprocess returned error exit status 
Aucun rapport « apport » n'a été créé car le message d'erreur indique une erreur consécutive à un échec p
récédent.
         dpkg: des problèmes de dépendances empêchent la configuration de flashplugin-installer :
 flashplugin-installer dépend de update-notifier-common (>= 0.119ubuntu2) ; cependant :
 Le paquet update-notifier-common n'est pas encore configuré.
dpkg: erreur de traitement du paquet flashplugin-installer (--configure) :
 problèmes de dépendances - laissé non configuré
dpkg: des problèmes de dépendances empêchent la configuration de ttf-mscorefonts-installer :
 ttf-mscorefonts-installer dépend de update-notifier-common (>= 0.119ubuntu2) ; cependant :
 Le paquet update-notifier-common n'est pas encore configuré.
dpkg: erreur de traitement du paquet ttf-mscorefonts-installer (--configure) :
 problèmes de dépendances - laissé non configuré
Aucun rapport « apport » n'a été créé car le message d'erreur indique une erreur consécutive à un échec p
récédent.
         Des erreurs ont été rencontrées pendant l'exécution :
 update-notifier-common
 flashplugin-installer
 ttf-mscorefonts-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried deleting the package and installing it again using pip version 20.0.2, but the same error occurs. Even with the package not present on the system, I get the error.

I have tried going into the files returning an error (/usr/lib/python3/dist-packages/debian/deb822.py) an figure out what was wrong by deleting lines where 'six' appeared (I know this is veeery bad practice but backup files were made all the time and I wanted to see if I could fix it by myself), but this proved unsuccessfull and was a desperate attempt.

Do you know how to fix this? Any help would be greatly appreciated.

This could be a possible solution. For future reference, it's usually not a good practice to mess with the system installed python, use a virtual environment to separate your python from the system's – C.Nivs Nov 19, 2020 at 16:42

I encountered an equivalent problem while updating the system (Ubuntu-Server 18.04, initially installed in 16.04).

# apt upgrade
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 24, in <module>
    import debian.deb822
  File "/usr/lib/python3/dist-packages/debian/deb822.py", line 49, in <module>
    import six
ModuleNotFoundError: No module named 'six'
dpkg: erreur de traitement du paquet update-notifier-common (--configure) :
installed update-notifier-common package post-installation script subprocess returned error exit status 1
dpkg: des problèmes de dépendances empêchent la configuration de ubuntu-server :
   ubuntu-server dépend de update-notifier-common ; cependant :
   Le paquet update-notifier-common n'est pas encore configuré.

as suggested in forum.ubuntu-fr.org, i tried to purge then reinstall the problem packages : update-manager, update-notifier, update-notifier-common.

apt purge update-manager update-notifier update-notifier-common
reboot
apt purge update-manager update-notifier update-notifier-common
apt update
apt upgrade

there were no more errors from this point on ... but when I tried to install the packages update-manager, update-notifier and update-notifier-common again then I got new errors!

apt install update-manager update-notifier update-notifier-common
  Des erreurs ont été rencontrées pendant l'exécution :
   update-notifier-common
   update-notifier
   update-manager
 ubuntu-release-upgrader-gtk
E: Sub-process /usr/bin/dpkg returned an error code (1)

So I permanently uninstalled these packages.

apt purge update-manager update-notifier update-notifier-common

for information, here is the content of /etc/apt/sources.list.

# grep bionic /etc/apt/sources.list
deb http://fr.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ bionic universe
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://fr.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.