I have an odd problem that I am hoping to get help with. My Python code uses the Requests module over HTTPS to get JSON information over the Internet. Everything works smoothly in the non-virtenv Python instance although I had to install OpenSSL/PyOpenSSL as discussed in this link to remove an insecure platform notification.
Now as part of playing with Flask, I have created a Virtual Environment. Unfortunately, the SSL error is back and every method listed in the link above does not work. Here is the error message:
/home/pi/.virtualenvs/flasktest1/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning
The most obvious solution is to install OpenSSL/PyOpenSSL inside the virtenv, but unfortunately the installation fails with the error listed below.
Command "/home/pi/.virtualenvs/flasktest1/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-6D2PfU/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-o43kpB-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pi/.virtualenvs/flasktest1/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-6D2PfU/cffi
I am now at a loss how to fix this. To be clear, this app is being developed behind a firewall and is for experimentation purposes only and will not be publicly accessible. However, this error is causing difficulties and I just want to make it stop.
Thank you in advance!
For me (OS X 10.10), a
pip install pyopenssl ndg-httpsclient pyasn1
fixed the issue.