2

I'm trying to install SSL on my PC, but I keep getting the error below. Am I missing something really basic here? I tried upgrading my pip and upgrading setuptools, but nothing seems to work. any help would be greatly appreciated.

C:\Users\Michael\PycharmProjects\py4e>pip3 install ssl
Collecting ssl
  Using cached https://files.pythonhosted.org/packages/83/21/f469c9923235f8c36d5
fd5334ed11e2681abad7e0032c5aba964dcaf9bbb/ssl-1.16.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\MICHAE~1\AppData\Local\Temp\pip-install-qtieo4so\ssl\setup.
py", line 33
        print 'looking for', f
                          ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print('loo
king for', f)?
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\M
ICHAE~1\AppData\Local\Temp\pip-install-qtieo4so\ssl\
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
michael
  • 63
  • 2
  • 5

2 Answers2

5

Given the error, it appears that your Python executable is Python 3.x (which requires print statements to be called with parentheses), but the package being installed is intended for Python 2.x. That likely means you need to upgrade your pip to Python 3 (you may already have it as pip3; i.e., try running pip3 install ssl).

It appears that the ssl package in the PyPi repository only supports Python 2 (https://pypi.org/project/ssl/), but the ssl library is already built into Python 3 (https://docs.python.org/3/library/ssl.html)

This means if you're using Python 3, no need to specify ssl in requirements.txt, if you do, you'll see the error from the question. Remove ssl from requirements.txt, and it will go away.

allenrabinovich
  • 384
  • 2
  • 10
  • 1
    Getting the same error when using pip3 install ssl I don't have to go back to python2 to install this right? Lots of people using python3 are able to use ssl? Just reposted the error result – michael May 14 '19 at 18:55
  • 1
    @michael -- looking into this a bit further, it appears that the ssl library in pip repository (https://pypi.org/project/ssl/) is only compatible with Python 2. But it also looks like `ssl` module is built into Python 3. Have you tried simply doing `import ssl`? – allenrabinovich May 14 '19 at 19:01
  • 1
    import ssl throws up the following error: Traceback (most recent call last): File "C:/Users/Michael/PycharmProjects/py4e/ex_13.05.py", line 3, in import ssl File "C:\Users\Michael\Anaconda3\lib\ssl.py", line 98, in import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed: The specified module could not be found. – michael May 14 '19 at 19:08
  • Since the specified module couldn't be found, i tried pip installing ssl which in turn led to the error message above. Thanks allen – michael May 14 '19 at 19:09
  • @michael -- it looks like your actual issue is with the Anaconda environment. I think the accepted answer here might be helpful: https://stackoverflow.com/questions/54175042/python-3-7-anaconda-environment-import-ssl-dll-load-fail-error – allenrabinovich May 14 '19 at 19:41
  • 1
    Thanks Allen. A pain, but i re-installed anaconda on my machine and that did it. A bit tedious but it works now so... thanks very much for your help on this. – michael May 14 '19 at 20:33
0

The above error means your pip is broken and is missing some files required for it to bypass SSL, you might try to install SSL via tarball but that too may fail, you may try adding trusted hosts to pip.conf and if that also fails, you have two options either remove your python version completely or just reinstall pip. Reinstalling pip won't work using pip commands due to SSL. So you can head to https://pypi.org/project/pip/ and download the tarball and install pip. Hope this helps.

Terry
  • 53
  • 5