-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ssl-issues] OpenSSL/SSL Issues for Python 2.7.6 users #377
Comments
Any development on this part? |
Hi, @Make42 and anybody else having problems with SSL connections, Python On Jul 18 2015, Make42 wrote:
Are you willing to help me help you? :) I need you to perform some tests, so I wrote an (unfinished) document with some instructions to see where the 1 - Does your system fail any of the tests? Please, again, keep in mind that the text is incomplete and that I would BTW, I use myself the program and I don't see the bug (or I would have fixed Anyway, here goes the text with the tests: Test 1You can perform some basic tests to see if your system If your system came with Python pre-installed (e.g., Linux, MacOS X or some To test this, open a terminal window and type the following commands:
The first one should give you immediately an error that starts with some
The specific numbers at the begininng of the line are not important, but the Now, type:
If it works well, it will print many lines, ending with something like:
and waiting there for you to type more commands. You can terminate the If that's what you get, please read the next step. If you get something Test 2In a Python (just type
If your installation is good, then you should see your Python interpreter If this is the case, you are strongly advised to install a newer version of Test 3In a Python (just type
If your installation is good, then you should see your Python interpreter
If you get an error message like Test 4As you can see, the text is unfinished, but I would love to know the answers Thanks, Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA |
Because I tried to install Python 2.7.10, my entire python is completely f**ed. Thus I am not able to run the other commands. I wrote a question on the issue on http://askubuntu.com/questions/648424/moun-is-gone-after-change-of-python-issues-after-python-2-7-10-installation-on but it seems nobody really cares :.-( (or knows anything). |
Hi. On Jul 20 2015, Make42 wrote:
Excellent. What about the result of the other openssl command? (The one
OK, I see. Let's try to fix things one by one.
I will try to elaborate it there (I already upvoted your question there, so I hope that I will get you to "unbreak" your installation, but you will have Of course, it is fun to do that, but only if you want to learn the process. Otherwise, relax and try to get your system fixed (but get your work done Do you have any instant messaging program? You can send me it via private Hope this helps, Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA |
Ok, the reporting is fine by me. Thank you very much! I am happy to learn this, since it seems to me, this is something worth knowing (how dpkg and and linux internals work and how to fix them if they don't). Since it is already the second time this year that I broke my system because of coursera-dl (last time I reinstalled) I am not so keen of reinstalling again. ;-) Since the notebook in question is my private machine and my business notebook is unaffected, I can "get my work done" without interference. Also, I downloaded the coursera courses the docker-way - so that worked. As soon as I am at my private machine I will try out the other ssl command. I have skype and jitsi. I am waiting for your list of commands I have to use to provide you with information at askubuntu, right? Btw.: I wrote an email to rbrito@ime.usp.br |
I'm having this same issue (also Ubuntu 14.04). Once Python 3.4 is installed, but not set as default, how would you run coursera-dl? The default is still Python 2.7.6, but I don't want to change that in order to avoid breaking the entire system (as highlighted above). |
@rbrito I haven't gotten any answer/questions from you... |
You may find the discussion in issue #330 useful. The underlying problem is Ubuntu 14.04 includes Python 2.7.6, which has some SSL compatibility problems. The simple Ubuntu-friendly option is to install python3 and pip3 via Ubuntu's apt package manager, then do |
@NelsonMinar Thanks for your comment. However, this will not do anymore. Not regarding the state of my System. Its python is completely damaged. See http://unix.stackexchange.com/questions/218911/help-me-repair-my-python-i-think-dpkg-has-to-be-reset-very-tricky-issue Edit: It got solved! I might try your solution later. |
@Make42 Python 2.7 pip didn't work for me in both Mac and Ubuntu systems. The following steps worked for me: Mac OSX (Yosemite):
Ubuntu 14.04 LTS
Usage Example
Hope it helps. |
Hi, @Make42. On Aug 02 2015, Make42 wrote:
I'm sending you a private e-mail so that we agree on a date to fix your After that, we can try to see this other issue, which seems unrelated (which Regards, Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA |
@rbrito You are too late to save my machine ;-). I was able to get the issue solved (see the edit above). Also (I just tried it out)
works for me indeed. Maybe this could be put into the README.md... ?! I forked the repo added the changed and made a pull request (it's my first time on github - I thought it might be something small to try this out in the wild.) |
Hi. I'm putting the text that I sent before via e-mail, since github thought that it was just a quote and made an ellipsis out of it. These are some diagnostics that I would appreciate if anybody could run (especially those that experienced the issue, solved/worked-around-it, but still can reproduce it), so that we can better understand the issue. (Oh, improvements to this text are highly welcome; Yes, contributing to our project (especially with documentation) is easy and it's never too late to get started!). Anyway, here goes the text with the tests: Test 1You can perform some basic tests to see if your system If your system came with Python pre-installed (e.g., Linux, MacOS X or some To test this, open a terminal window and type the following commands:
The first one should give you immediately an error that starts with some
The specific numbers at the begininng of the line are not important, but the Now, type:
If it works well, it will print many lines, ending with something like:
and waiting there for you to type more commands. You can terminate the If that's what you get, please read the next step. If you get something Test 2In a Python (just type
If your installation is good, then you should see your Python interpreter If this is the case, you are strongly advised to install a newer version of Test 3In a Python (just type
If your installation is good, then you should see your Python interpreter
If you get an error message like Test 4As you can see, the text is unfinished, but I would love to know the answers |
This is re-post of my comment from issue #383 with error log and some more info. I am using Ubuntu 14.04 LTS 64 bit. Default python version is 2.7.6. When I run vagrant@python:~$ coursera-dl -u username@gmail.com -p password --on-demand machine-learning
Downloading class: machine-learning
Starting new HTTPS connection (1): www.coursera.org
/usr/local/lib/python2.7/dist-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
Traceback (most recent call last):
File "/usr/local/bin/coursera-dl", line 9, in <module>
load_entry_point('coursera==0.0.3', 'console_scripts', 'coursera-dl')()
File "/usr/local/lib/python2.7/dist-packages/coursera/coursera_dl.py", line 942, in main
result = download_on_demand_class(args, class_name)
File "/usr/local/lib/python2.7/dist-packages/coursera/coursera_dl.py", line 885, in download_on_demand_class
login(session, args.username, args.password)
File "/usr/local/lib/python2.7/dist-packages/coursera/cookies.py", line 115, in login
headers=headers, allow_redirects=False)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 431, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure A temporary workaround I figured out was using python3 via virtualenv because it isn't easy to upgrade python's default version in ubuntu, it fixes one thing and breaks many. Here's workaround that worked for me:
@rbrito if you want any more info or logs, I would be glad to help. |
@haisum, first of all, thank you so very much for both your willingness to help and your detailed response. I have other questions (and these are valid for every other poster/subscriber of this bug report---the more answers that we get, the more likely that I am to see the pattern---hopefully): 1 - What is the version of Python 3 that you are using? You can find it via the following command:
2 - Do the problems that you describe persist if you use a virtual environment with your default Python 2 interpreter? 3 - Can you run the tests that I wrote about in #377 (comment) with your Python 2 interpreter outside of any virtual environment? I would really love to know what may be happening and where the issues may lie. 4 - Are you willing to compile a short module for your Python 2 interpreter inside a virtualenv? If yes (and that would help a lot), then I would love it if you, first, installed (regularly, outside of a virtualenv) the following packages in your Ubuntu:
Then, create new a virtual environment with Python 2 (as usual), enter it, install everything as you would (e.g., inside the virtual environment type
Some of the packages above may be already installed (they were likely installed when you run I have some more questions that I would like to have answered, but let's take those one at a time. :) Thanks a lot, Rogério. |
@rbrito, I installed Ubuntu 14.04 on a virtual machine and followed your instruction about installing new modules:
Fortunately, It worked and the error never appeared again. I also test it on windows with Python 2.7.6 already installed and got the same result by only installing |
Here are the results: What is the version of Python 3 that you are using?
Do the problems that you describe persist if you use a virtual environment with your default Python 2 interpreter?Yes. Can you run tests?First TestEverything fine. Second Testvagrant@python:~/coursera2$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23
>>> from ssl import HAS_SNI
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name HAS_SNI Also note that advice of upgrading default python, as given in test 2 text, on Ubuntu is not practical in most of cases because ubuntu heavily relies on python and upgrade may cause failures elsewhere on system. Third Test>>> r = requests.get("https://class.coursera.org")
/usr/local/lib/python2.7/dist-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
/usr/local/lib/python2.7/dist-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
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 69, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 594, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 196, in resolve_redirects
**adapter_kwargs
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 431, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure Willing to compile short module?sudo apt-get install build-essential python-dev libssl-dev libffi-dev
virtualenv -p /usr/bin/python coursera
cd coursera
./bin/pip install urllib3 pyasn1 ndg-httpsclient pyOpenSSL
/home/vagrant/coursera3/local/lib/python2.7/site-packages/pip/_vendor/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
Collecting urllib3
/home/vagrant/coursera3/local/lib/python2.7/site-packages/pip/_vendor/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
Using cached urllib3-1.11-py2.py3-none-any.whl |
I was able to solve issue with stock python by upgrading ndg-httpsclient module by using following command: sudo pip install --upgrade ndg-httpsclient This fixes the issue on default python without upgrading it. Source: Jessica's answer on http://stackoverflow.com/questions/29099404/ssl-insecureplatform-error-when-using-requests-package |
FYI
Downloading https://class.coursera.org/regmods-032/lecture/download.mp4?lecture_id=171 -> /run/media/admin/My Book/CURRENTcoursera/regmods-032/01_Week_1/01_01_01_Part_1_of_4_Introduction_to_Regression_6-03.mp4
|
@rbrito What's the status on this issue? Could you please summarize? Should we catch the error in the code and print a message that recommends to install |
Scrub my suggestion above that problem could conceivably be specific to ..."the Data Science Specialization at Coursera. Conceivably course staff rather than coursera doing something new?" I now assume it was just coincidence that my report was from same series of monthly repeated courses as the original report at top of thread. I previously thought it was not occurring for me with several other coursera courses I was still downloading. But they may have been completed with no actual file downloads but just successfully checking the index pages. Just encounted the same problem with unrelated coursera course and it only happens AFTER index page successfully obtained, at first actual file download: Downloading class: valuation-001 PS Have not done and now cannot do any testing due to sudden family emergency. |
Just happen to have the same condition as @dentarthur ... |
Hi @rbrito, I am still facing this issue on Ubuntu 16.04 (Python3.5)
I have tried following and facing the issue,
|
Hey @rbrito thanks for making this. I tried coursera-dl today and am getting this error. I am running python 3.6.5 in a virtualenv with I have read both #330 and #377, no luck. All the tests you mentioned above pass. Any help please? If there is any more information you want, I am ready to give. I have attached the output of the --debug |
FTR, should be fixed in 0.11.2. |
Hello, I still get the same errors as a couple of months ago:
I still have Python 2.7.6 on Ubuntu 14.4. I know it would be better to have Python 2.7.10 but this will not change anytime soon, since this is just the Python version that is in Ubuntu 14.4 has. PLEASE, can this be fixed, so that it works with python 2.7.6 ?
(As a matter of fact I even tried installing Python 2.7.10, and even though
I get the same error.)
The text was updated successfully, but these errors were encountered: