A beginner in Python encountered an ERROR when installing pip

When I was installing pip, I set the environment variables according to someone else’s instructions. However, when the terminal displayed the download information, it suddenly gave an error. The following is the error message:
ERROR: Exception:
Traceback (most recent call last):
File “D:\python\Python_3.11\Lib\site-packages\pip_vendor\urllib3\response.py”, line 438, in _error_catcher
yield
File “D:\python\Python_3.11\Lib\site-packages\pip_vendor\urllib3\response.py”, line 561, in read
data = self._fp_read(amt) if not fp_closed else b""
^^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\site-packages\pip_vendor\urllib3\response.py”, line 527, in _fp_read
return self._fp.read(amt) if amt is not None else self._fp.read()
^^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 98, in read
data: bytes = self.__fp.read(amt)
^^^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\http\client.py”, line 473, in read
s = self.fp.read(amt)
^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\socket.py”, line 706, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\ssl.py”, line 1314, in recv_into
return self.read(nbytes, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\ssl.py”, line 1166, in read
return self._sslobj.read(len, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\commands\install.py”, line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py”, line 179, in resolve
self.factory.preparer.prepare_linked_requirements_more(reqs)
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\operations\prepare.py”, line 552, in prepare_linked_requirements_more
self._complete_partial_requirements(
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\operations\prepare.py”, line 467, in _complete_partial_requirements
for link, (filepath, _) in batch_download:
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\network\download.py”, line 183, in call
for chunk in chunks:
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\cli\progress_bars.py”, line 53, in _rich_progress_bar
for chunk in iterable:
File “D:\python\Python_3.11\Lib\site-packages\pip_internal\network\utils.py”, line 63, in response_chunks
for chunk in response.raw.stream(
File “D:\python\Python_3.11\Lib\site-packages\pip_vendor\urllib3\response.py”, line 622, in stream
data = self.read(amt=amt, decode_content=decode_content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\python\Python_3.11\Lib\site-packages\pip_vendor\urllib3\response.py”, line 560, in read
with self._error_catcher():
File “D:\python\Python_3.11\Lib\contextlib.py”, line 158, in exit
self.gen.throw(typ, value, traceback)
File “D:\python\Python_3.11\Lib\site-packages\pip_vendor\urllib3\response.py”, line 443, in _error_catcher
raise ReadTimeoutError(self._pool, None, “Read timed out.”)
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.

I hope all the experts out there can help me! Please!

Hello,

Why are you installing pip? It comes bundled together with Python download.

If you want to upgrade it to the latest version, type the following in the CMD prompt:

py -m pip install --upgrade pip

What you can do, to simplify things, uninstall Python and reinstall it.

Tip:
Try to avoid having multiple versions of Python installed on your system as this can lead to unintended consequences - at least until you know what you are doing and there is a valid reason for doing so. For example, if you install packages to version A, but you are using version B, you’ll be wondering why importing packages into your Python script while using version B is not working and generating an exception (i.e., error - ModuleNotFound, etc.).

Following your suggestion, I deleted the original Python and reinstalled a new one. However, this still didn’t make any difference. The program still keeps giving errors frequently.

Try this one more time:

  • Type py -0 in the command prompt. What version(s) is(are) displayed?
  • Make sure to delete ALL versions of Python from your system (to restart with a clean slate).

Then go to the command line and type:

pip --version

What is the output? Just want to make sure there is no lingering independent pip on your system as per your original post as you had stated that you attempted an independent installation. “If” a pip version is displayed, delete it - from the directory that is displayed.

Afterwards, after having removed ALL previous versions, reinstall Python - preferrably the latest stable version - v3.13? from python.org.

After having installed the latest version, once again go to the command prompt and type:

path

then type

pip --version

The pip directory should be within one of the directories listed in path.