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: [email protected]
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
1
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.
2
Answers
I encountered an equivalent problem while updating the system (Ubuntu-Server 18.04, initially installed in 16.04).
as suggested in forum.ubuntu-fr.org, i tried to purge then reinstall the problem packages : update-manager, update-notifier, update-notifier-common.
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!
So I permanently uninstalled these packages.
for information, here is the content of /etc/apt/sources.list.
Try
sudo pip3 install six
this fixed it for me. Apparently six needs to be installed as a sudo user.