pythonpython-modulefailed-installationpython-ssl

Found this error "subprocess-exited-with-error, python setup.py egg_info did not run successfully" while installing ssl module


This is the complete error:

C:\WINDOWS\system32>pip install ssl
Collecting ssl
  Using cached ssl-1.16.tar.gz (33 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\__init__.py", line 270, in <module>
          monkey.patch_all()
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\monkey.py", line 96, in patch_all
          patch_for_msvc_specialized_compiler()
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\monkey.py", line 156, in patch_for_msvc_specialized_compiler
          patch_func(*msvc14('_get_vc_env'))
                      ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\monkey.py", line 146, in patch_params
          mod = import_module(mod_name)
                ^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
          import unittest.mock as mock
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\unittest\mock.py", line 26, in <module>
          import asyncio
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\asyncio\__init__.py", line 8, in <module>
          from .base_events import *
        File "C:\Users\WINDOWS\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 34, in <module>
          import ssl
        File "C:\Users\WINDOWS\AppData\Local\Temp\pip-install-6t66qbb1\ssl_2992740d127c414fa526766aa7d3f686\ssl\__init__.py", line 140
          except SSLError, x:
                 ^^^^^^^^^^^
      SyntaxError: multiple exception types must be parenthesized
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

What I was expecting

I want to install the SSL module.

What I was using

Python 3.11.5 for Windows 10 x64 (latest stable)

Wheel 0.41.2 (latest)

Setuptools 68.1.2 (latest)

What I tried

From the suggestion of other similar problems from stack overflow and google

Updated Python from 3.11.4 to 3.11.5, Wheel and setuptool but it didn't work for me


Solution

  • I believe the ssl package hosted on Pypi is for python version 2 only.

    If you are using python 3 then ssl is part of the standard library so there is no need to install anything, just import ssl.