aajanki / yle-dl

Download videos from Yle servers
https://aajanki.github.io/yle-dl/index-en.html
GNU General Public License v3.0
309 stars 51 forks source link

Dependency problem urllib3 on OS X #342

Open DiscoNova opened 1 year ago

DiscoNova commented 1 year ago

After installing yle-dl on a new Macbook running OS X 13.4, attempt to run the code fails with following traceback:

Traceback (most recent call last):
  File "/Users/utu/Library/Python/3.9/bin/yle-dl", line 5, in <module>
    from yledl.yledl import main
  File "/Users/utu/Library/Python/3.9/lib/python/site-packages/yledl/__init__.py", line 18, in <module>
    from .backends import Backends
  File "/Users/utu/Library/Python/3.9/lib/python/site-packages/yledl/backends.py", line 29, in <module>
    from .http import HttpClient
  File "/Users/utu/Library/Python/3.9/lib/python/site-packages/yledl/http.py", line 22, in <module>
    import requests
  File "/Users/utu/Library/Python/3.9/lib/python/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/Users/utu/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py", line 38, in <module>
    raise ImportError(
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168

Temporary (?) workaround

It is possible to get the code working using an earlier, compatible version of urllib3; e.g. anything < 2.0.0 does not have a strict OpenSSL version requirement.

pip3 install 'urllib3<2'

Unfortunately I can't attest whether this is compatible with any other software installed on a machine, so this workaround might not be a proper solution for everyone.

I understand that this is more a problem with the environment rather than an issue with yle-dl, but I feel like at least documenting the workaround here might help someone in the future who might encounter the same issue.

Environment

aajanki commented 1 year ago

Installing 'urllib3<2' indeed sounds like a good workaround as long as there's no other software that needs the latest urllib3.

Another suggested solution according to various discussions boards is to install Python from homebrew or Macports. Apparently, Pythons from those sources are compiled against OpenSSL and therefore work with the latest urllib3. Can any Mac user test and confirm this?

DiscoNova commented 1 year ago

Somehow the response has managed to slip past my radar, but better late than never...

Unfortunately I'm a multiholic sipping both brew and ports, so my setup is "a bit of a mess" to state it mildly and I'm having difficulties tracking where each piece of environment is coming from; thus ... I don't feel comfortable stating with certainty that this is a working solution - but it sure sounds like one. Since implementing my original workaround I've had no problems with yle-dl.

If someone else believes they can confirm this, I believe this issue could be marked as solved.

While I am definitely a Mac-fanboy, admittedly there are some things that are difficult to achieve; mainly due to Apple's reluctance towards GPLv3 and the lack of "one package manager to rule it all" ☹️