Getting httplib2 error when running apt-get commands on Pop!_OS 22.04

Question:

I just updated to pop os 22.04 lts and now not only it can’t detect any output and input devices on my computer but I also can’t run any apt-get commands, whenever I try to run it I receive the error:

from httplib2.error import ServerNotFoundError
ModuleNotFoundError: No module named 'httplib2.error'
dpkg: error processing package pop-default-settings (--configure):
 installed pop-default-settings package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 pop-default-settings
E: Sub-process /usr/bin/dpkg returned an error code (1)
/etc/apt/sources.list.d/pop-os-apps.sources:URIs: http://apt.pop-os.org/proprietary
Traceback (most recent call last):
  File "/usr/bin/apt-manage", line 32, in <module>
    from repolib import command
  File "/usr/lib/python3/dist-packages/repolib/command/__init__.py", line 24, in <module>
    from .add import Add
  File "/usr/lib/python3/dist-packages/repolib/command/add.py", line 23, in <module>
    from httplib2.error import ServerNotFoundError

I tried running pip install httplib2 but then I get

Command 'pip' not found, but can be installed with: sudo apt install python3-pip

If I try to run sudo apt install python3-pip I get the httplib2 error.

python3 –version returns Python 3.10.6

Asked By: Gabriel Costa

||

Answers:

Happened to me too. It seemed to be happening because /usr/lib/python3/dist-packages/ had httplib2 version 0.18 when a newer version was expected. Normally, doing sudo apt install python3-httplib2 would be the way to update this packge. Since that was currently impossible, I manually overwrote the package with a newer version.

python3 -m pip install --upgrade httplib2
python3 -m pip show httplib2

This should install an up-to-date version (at least 0.21) of httplib2 to the directory listed after "Location: " in the pip show httplib2 output. Then I just did:

sudo rm -rf /usr/lib/python3/dist-packages/httplib2*
sudo cp -r <location>/httplib2* /usr/lib/python3/dist-packages/

After this, I could run sudo apt upgrade without errors.

Answered By: checkmate

Happened to me also. After going through the steps that checkmate provided I got a similar error stating: No module named ‘pyparsing’. All you need to do is repeat the same steps changing "httplib2" with "pyparsing". So the commands should be:

python3 -m pip install --upgrade pyparsing
python3 -m pip show pyparsing
sudo rm -rf /usr/lib/python3/dist-packages/pyparsing*
sudo cp -r <location>/pyparsing* /usr/lib/python3/dist-packages/

It worked for me.

Answered By: Djuradj Gvozdenovic
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.