Youtube-dl No Module Named ‘pkg_resources’
youtube-dl doesn’t work for me after a recent update. I do not use it often, so do not know whether the update matters. It gives the error message:
Traceback (most recent call last):
File “/usr/bin/youtube-dl”, line 6, in
from pkg_resources import load_entry_point ModuleNotFoundError: No module named ‘pkg_resources’
I’ve tried reinstalling python-setuptools, installing python34-setuptools and reinstalling youtube-dl .
I’m aware there is a bugzilla on it. That and stackoverflow are where I got the ideas above.
How do I make youtube-dl work on CentOS 7?
4 thoughts on - Youtube-dl No Module Named ‘pkg_resources’
How did you install it?
I’m using their binary and it works great, just tested it.
https://ytdl-org.github.io/youtube-dl/download.html
Most recently yum reinstall youtube-dl
So am I. Despite generally favoring regular repositories, in the particular case of youtube-dl I prefer to uninstall the repo version, and follow the instructions on their website above. I just do a wget and a chmod as explained there, and it downloads itself into /usr/local/bin. Whenever it fails to work, usually a simple
sudo youtube-dl -U
will update itself to the latest version, which does work.
The errors you encounter are typically not a problem in the script itself, nor in python, but a change in the structure of the youtube.com html code. It gets changed often, and then the older youtube-dl fails to parse the new youtube.com code structure, and errors out. But usually there is an updated version (often the same day) of youtube-dl, which parses the new html code correctly.
If you use the repo version of youtube-dl, it may take a couple of weeks even for the update to land. On the other hand, the above manual update works immediately, with no hassle.
Never failed me so far.
HTH, :-)
Marko
If you are using the EPEL one, you can resolve it by installing:
(1) python36-setuptools from epel and
(2) youtube-dl from epel-testing
Akemi