Youtube-dl dies on startup

I’ve just installed the Leap 15.1 version of youtube-dl, and it encounters some kind of configuration error on startup:

gorbie@linux-8o7h:~/Music> youtube-dl
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/bin/youtube-dl/__main__.py", line 16, in <module>
  File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 15, in <module>
  File "/usr/bin/youtube-dl/youtube_dl/options.py", line 8, in <module>
  File "/usr/bin/youtube-dl/youtube_dl/downloader/__init__.py", line 3, in <module>
  File "/usr/bin/youtube-dl/youtube_dl/downloader/common.py", line 9, in <module>
  File "/usr/bin/youtube-dl/youtube_dl/compat.py", line 22, in <module>
ImportError: No module named xml.etree.ElementTree

How can I get past this, or at least find a place to report the problem and perhaps find a remedy?

This post may be a duplicate; I tried to post this earlier, but it seems to have gotten lost.

Hi
Is python-xml installed?

If you have the packman repo configured, install from there. That should pull in any needed dependencies.

FWIW, you cannot start youtube-dl just like that.You need to provide a URL to the specific youtube video you want to download. There’s also youtube-dl-gui, but that currently won’t install on Tumbleweed ( my openSUSE version ) due to a missing dependency

I tried the simple **youtube-dl **by itself only as a simplification when the command I really wanted gave me that error. I was indeed missing **python-xml, **so I installed it and got somewhat further. Then I tried this:

youtube-dl --extract-audio --audio-format wav -i https://www.youtube.com/watch?v=5NpPRrlMhp0

which is what I really wanted. That produced this:

ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.

**ffmpeg **was present but neither ffprobe, avprobe, nor avconv could be found when Yast searched its repositories. Adding the Packman repository did not help.

avconf can nowadays be found in **libav-tools

**Handy hint; If you do not know what package contains a specific command, try cnf, for example:


miuku@sle15node1:~> cnf avconv
                        
The program 'avconv' can be found in the following package:
  * libav-tools  path: /usr/bin/avconv, repository: zypp (SLE-Backports) ]


Try installing with:
    sudo zypper install libav-tools

Updated 15.1 here.

FWIIW, here it runs as expected:

henk@boven:~> youtube-dl
Usage: youtube-dl [OPTIONS] URL [

youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.
henk@boven:~> 

]()

When installing the system I followed: 13. Multimedia Codecs - Install Support for restricted codecs including MP3, DVD, WMA, WMV, MOV etc. I ran now youtube-dl --extract-audio --audio-format wav -i https://www.youtube.com/watch?v=5NpPRrlMhp0 and opened Dolphin. Upon clicking “Djinji Dinji Bubamara - Emir Kusturica-5NpPRrlMhp0.wav” vlc pops up and plays the music.

Are you using zypper or pip for youtube-dl?

In either case, I always found pip to be more stable with python packages. Try this:

pip install --upgrade youtube-dl

Am I right that you only added th Packman repository to your enabled repositories at this moment and that before Packman was not used at all?

Then my strong advice is to not only add Packman to your repo list (as you just did), but also use and do the vendor switch to Packman.

zypper dup --from <the #, alias or name from your Packman repo>

(or the equivalent from YaST > Software > Software management; choose the Repositories from the View menu, select Packman at left and at right, above the list, click on Switch system packages to the version in this reposirory

Remark that all those posting here assume you have done so already long ago.

All people above, who have no problems, used zypper and/or YaST to install (from Packman).
I do not realy know what “pip” is, but I see no reason to suggest the OP to use other installation tools then the standard ones, the more where nobody has any problems with the product installed in the normal way.

Hi Henk,

Since youtube-dl is a python macro, I manage it using pip (pip · PyPI or pip documentation v24.0) which is the python package manager. I’ve personally never maintained python packages using zypper (scipy, numpy, matplotlib, youtub-dl, and etc.) but pip helps staying up to date. I have had (old) version issues using zypper personally.

If nobody else has any problems using zypper to install python packages, I won’t contradict it, but some minor version issues can get easily resolved by maintaining python packages such as youtube-dl using pip.

I have never even contemplated about what language it is written in. It is just a package that is available to openSUSE users as an RPM in openSUSE and/or Packman repos. It should install correct when using the openSUSE tools and function correct. When that is not the case we have to find out why, and when that emerges to be a bug, it should be reported as a bug and repaired.

It is nice when you do things different then the avarage user, but please be aware of the fact that not everybody likes it to be presented with yet another way to install and stay up-to-date, different from the openSUSE way. That is confusing advice for many. And except when you could reproduce the problem with a normal installed youtube -dl and that it is not reproducable with your way of installing (and thus can be used as a temporary by-pass), the advice is based in very thin air imho.

The point about using “zypper”, is that it will make sure that any dependency problems are resolved.

Henk,
Point taken. I will keep things “standard” way at the fourms.

nrickert, I do use most packages with zypper but I strictly use pip for python only to avoid version inconsistency between distros/OSes. I think maybe once I had an issue with python package managed by zypper due to something like python3-numpy from Opensuse repository being older than what was being used in a macro (and the macro was written depending on something like an exit flag from newer numpy at the time), I will refrain from diverting from the topic.

I was having the issue, and have changed youtube-dl from system to packman. Same issue in youtube-dl-gui.
But with either package, I can use a konsole prompt and run youtube-dl manually. Any solution to this other than using some other sytem?

And if not, how would I use pip to do it so I can click on my youtube-dl-gui icon? I’m not familiar with using pip and what it really does. I understand it installs things, and maybe you can run things from it, but how do you do it with an icon on my system menu?