Python 2 not "built with ssl module"?

self = <future.backports.urllib.request.UnknownHandler object at 0x7fa9cef697d0>
req = <future.backports.urllib.request.Request object at 0x7fa9cd066c10>

def unknown_open(self, req):
    type = req.type
>   raise URLError('unknown url type: %s' % type)
E   URLError: <urlopen error unknown url type: https>

I am getting problems because apparently Python on CircleCI wasn’t built for ssl? (says a discussion on stack overflow that I can’t link from this posting…)

I’m wondering if I can re-install Python with ssl support or something similar? …or maybe I’m totally wrong :slight_smile:

To clarify: everything works locally, just on Circle am I getting this strange error about https not being supported – some googling leads me to believe Python2/OpenSSL/something was built weirdly?

Python 3 works, Python 2 doesn’t.

Thanks for any help!

It could be that Python 2 was built without SSL support, although that’s quite unlikely. Are you specifying a Python version in your circle.yml? If so, which one specifically? Have you tried other 2.* versions?

If there is a need to build a custom version of Python, you could potentially do that during the build and save the resulting binaries to the cache as suggested right here.

Thanks so much for the reply!

Here’s my results:

And here’s my latest circle.yml trying to install a new version of Python 2

    version: 3.5.0

    - sudo add-apt-repository ppa:fkrull/deadsnakes -y
    - sudo apt-get update
    - sudo apt-get install --reinstall python2.7
    - (virtualenv ~/virtualenvs/venv-2.7.5 -p python2.7)
    - (deactivate && source ~/virtualenvs/venv-2.7.5/bin/activate && pip install -r requirements27.txt && deactivate)
    # Then do it for python 3.5.0
    - pip install -r requirements35.txt
    - (deactivate && source ~/virtualenvs/venv-2.7.5/bin/activate && py.test)
    - py.test

The above version fails with…

pyenv: python2.7: command not found

The `python2.7' command exists in these Python versions:

What else could be causing the URLError: <urlopen error unknown url type: https> error, if not something with Python SSL support? Same code works locally for me (2.7) and it works in 3.5.

I could be doing something completely stupid, but it’s very frustrating things work locally for me and I get different behavior on CircleCI.

Which step exactly fails with the command not found error?

I am not aware of anything that could be causing this issue apart from the SSL support in Python.

If you see that there is no way to make this work with the pre-installed Python versions, you might need to compile the version you need with the necessary options from source and then cache the resulting binary, as described right here.