Installing Youtube-dl on Redhat & Centos 7 (Works!) Updated*

I use youtube-dl to pull content down to an emby server where i can watch things at my own leisure from any room in my home.  It installs without issue on other distros such as Ubuntu.  However, from my experience, this is not always the case (most recently) with Centos / RHEL.

When installing youtube-dl via yum on a minimal install of Centos 7 you will not be greeted with a working application.  A method that works without error is to install youtube-dl via pip.  If installed with yum / EPEL repositories you will encounter the following error:

1
2
3
4
5
[root@mini ~]# youtube-dl
Traceback (most recent call last):
File "/usr/bin/youtube-dl", line 6, in
from pkg_resources import load_entry_point
ImportError: No module named 'pkg_resources'

Yum does install necessary prerequisites including python libraries, however it still does not function.  So lets install youtube-dl with a method that works – this code will also install ffmpeg, which will be required when converting video with youtube-dl to alternative formats.

1
2
3
4
5
6
7
8
9
10
11
12
#install python libraries
yum install -y python-six
yum install -y python-pip
yum install -y python34-setuptools
yum install -y python36-setuptools
yum install -y python37-setuptools
yum install -y ffmpeg ffmpeg-devel
yum install -y youtube-dl
pip install --upgrade pip
pip install youtube-dl
rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

If you receive the following after installing, it is likely due to a mismatched or unavailable version of python setup tools for your installed version of python

1
2
3
4
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'

To remedy:

1
2
3
4
yum install -y python34-setuptools
yum install -y python36-setuptools
yum install -y python37-setuptools
#etc
Lima

About the author

Lima is the visual nautical indicator for "stop instantly."

Comments

Leave a Reply

%d bloggers like this: