Score:0

ModuleNotFoundError: No module named 'http.client'

is flag

Running Ubuntu Server 22.04, and I get this error when I try to run python scripts that I've been using. The simplest case is literally just: import requests

This appears to be happening system-wide, even for scripts that use their own virtual environment, which is very weird. Everything was working fine until today, and I haven't messed with pip or python packages recently. Tried looking it up, and nothing of relevance came up. Here is the full output when I try to run a script that is just: import requests

Traceback (most recent call last):
  File "/home/mahmoud/http_python_test.py", line 1, in <module>
    import requests
  File "/home/mahmoud/.local/lib/python3.10/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/__init__.py", line 11, in <module>
    from . import exceptions
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/exceptions.py", line 3, in <module>
    from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/packages/six.py", line 199, in load_module
    mod = mod._resolve()
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/packages/six.py", line 113, in _resolve
    return _import_module(self.mod)
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/packages/six.py", line 82, in _import_module
    __import__(name)
ModuleNotFoundError: No module named 'http.client'
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 21, in <module>
    from urllib.request import urlopen
  File "/usr/lib/python3.10/urllib/request.py", line 88, in <module>
    import http.client
ModuleNotFoundError: No module named 'http.client'

Original exception was:
Traceback (most recent call last):
  File "/home/mahmoud/http_python_test.py", line 1, in <module>
    import requests
  File "/home/mahmoud/.local/lib/python3.10/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/__init__.py", line 11, in <module>
    from . import exceptions
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/exceptions.py", line 3, in <module>
    from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/packages/six.py", line 199, in load_module
    mod = mod._resolve()
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/packages/six.py", line 113, in _resolve
    return _import_module(self.mod)
  File "/home/mahmoud/.local/lib/python3.10/site-packages/urllib3/packages/six.py", line 82, in _import_module
    __import__(name)
ModuleNotFoundError: No module named 'http.client'
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.