My Ubuntu server version is 22.04 and Python is 3.10.6.
And the pip version is 22.0.2
pip install htttp
The above command was entered to install the http module, but an error occurred.
Collecting http
Downloading http-0.02.tar.gz (32 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-wt_twpw1/http_e204a51ec15142428e42fe97cce6fbe8/setup.py", line 3, in <module>
import http
File "/tmp/pip-install-wt_twpw1/http_e204a51ec15142428e42fe97cce6fbe8/http/__init__.py", line 17, in <module>
from request import Request
ModuleNotFoundError: No module named 'request'
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
File "/tmp/pip-install-wt_twpw1/http_e204a51ec15142428e42fe97cce6fbe8/http/__init__.py", line 17, in <module>
from request import Request
ModuleNotFoundError: No module named 'request'
Looking at the error contents, it seemed that the request module was not installed.
so
pip install request
However, the request module also cannot be installed.
ERROR: Could not find a version that satisfies the requirement request (from versions: none)
ERROR: No matching distribution found for request
I need some help.
2
Answers
Python3 contains http package by default.
You don’t need to install it.
Just do
import http
at your script, it will run fine.I had the same problem.
I found the solution in this post. Install pip2 and python2. Then, type:
So I think, this is the only way.