Unable to install yt-dlp

Hello, I am trying to install yt-dlp but the installation fails due to python-certifi.
Not sure how to proceed.

Following is the relevant log:

sudo pacman -S yt-dlp 
resolving dependencies...
looking for conflicting packages...

Package (2)               New Version   Net Change

community/python-certifi  2022.09.24-1    0.01 MiB
community/yt-dlp          2022.11.11-1   21.11 MiB

Total Installed Size:  21.12 MiB

:: Proceed with installation? [Y/n] Y
(2/2) checking keys in keyring                                                                                                                  [----------------------------------------------------------------------------------------] 100%
(2/2) checking package integrity                                                                                                                [----------------------------------------------------------------------------------------] 100%
(2/2) loading package files                                                                                                                     [----------------------------------------------------------------------------------------] 100%
(2/2) checking for file conflicts                                                                                                               [----------------------------------------------------------------------------------------] 100%
error: failed to commit transaction (conflicting files)
python-certifi: /usr/lib/python3.10/site-packages/certifi-2022.9.24.dist-info/LICENSE exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi-2022.9.24.dist-info/METADATA exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi-2022.9.24.dist-info/RECORD exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi-2022.9.24.dist-info/WHEEL exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi-2022.9.24.dist-info/top_level.txt exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/__init__.py exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/__main__.py exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/__pycache__/__init__.cpython-310.pyc exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/__pycache__/__main__.cpython-310.pyc exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/__pycache__/core.cpython-310.pyc exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/cacert.pem exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/core.py exists in filesystem
python-certifi: /usr/lib/python3.10/site-packages/certifi/py.typed exists in filesystem
Errors occurred, no packages were upgraded.

Thanks a lot for your help.

Have you tried

sudo pacman -S --force yt-dlp

Have you by any chance installed software using sudo pip?

That will cause that problem.

If so, you should sudo pip to remove any software you installed that way.

1 Like

Didn’t force get removed from pacman years ago?

Primarily to stop people using it in a situation like this one.

1 Like

@dalto
I wasn’t sure whether to recommend the --overwrite flag

It is better to remove the software the same way it was installed. --overwrite should only be used as a last resort.

Wasn’t sure what the package actually is.

Edit: I know it’s python related.

You’ve most likely installed a package called certifi using pip You should remove that package first:

sudo pip uninstall certifi

After that, install yt-dlp again:

sudo pacman -Syu yt-dlp
3 Likes

Why don’t you just follow the instructions on the yt-dlp github project page:

sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp # Make executable

If he did this, wouldn’t it be inconvenient for him to update the package later on?

Also, what if, in the future, he tries to install (via pacman) some other package (not yt-dlp) that requires python-certifi? At the moment, python-certifi is already installed on his system, just that it isn’t recorded inside pacman’s local database. The way I see it, this will lead to a mess down the line.

1 Like

Not a problem. If yt-dlp needs updating, just download the latest and set the executable bit. Or, just run sudo yt-dlp -U. It takes next to no time and always just works. The yt-dlp script is just a script that does not affect anything else on the system. Grabbing the script does not cause any problems.

yt-dlp is a full-blown software package with at least 3000 python source files and 8 optional dependencies. I fail to see how yt-dlp is “just a script” that “does not affect anything else on the system.”

Or you could skip all the hassle and just run sudo pacman -Syu, and yt-dlp (along with everything else in the system) gets updated.

Sure. But yt-dlp might require ffmpeg, rtmpdump, python-mutagen, python-pycryptodomex to work, depending on how the OP wants to use yt-dlp. Each of those packages could be a dependency of some other package in the official repo. Installing those packages externally might lead to problems down the line. It’s just a matter of time before this results in a mess.

3 Likes

Terrible advice. There is never a need to run this program as root. And whenever there is no need to use sudo, doing so is stupid.

Let your package manager worry about updating and installing your software, don’t go behind its back.

4 Likes

The yt-dlp script is a 2.5Mb Python script that is independently copied into the /usr/local/bin folder. I have always just copied into place on my Debian system and it just works. It does not require me to install any other software (maybe I coincidentally installed all its dependencies without knowing?). I use the Arch package on Arch only because its in the repos. Grabbing the script alone works just as well as installing the package. The instructions for installation is given right on the project website. It could not be easier to follow.

Advice is taken right from the developer’s project page. If you want to let the script fetch its own update and place it in a root owned folder such as /usr/local/bin it will need admin privileges. Not stupid, but common sense.

Why would you want some script to update itself? That’s the pinnacle of stupid, especially on Arch, where you have pacman to update it for you.

Just for a sake of science…In 99,99% - you’re absolutely correct.

However there are few cases where it’s wise to manually manage some packages, for example if you don’t trust anyone except their devs / yourself to check / compile it…For instance TOR comes to mind, for me personally, although i advice people to do same for stuff like Telegram.

Better to just place it in .local/bin and add it to your path :thinking:

If you do not trust the TUs who maintain the Arch repo, you shouldn’t be using Arch. There are many, many easier ways for them to take over your machine than to make a malicious Tor package.

Besides torbrowser-launcher is intentionally just a launcher, for this purpose. It fetches the Tor browser from the same place you would.

So no, you should definitely use the torbrowser-launcher package, not install it manually yourself. There is no security downside to that, and you take advantage of package management.

Why? How is that better? I mean, it is better than running it with sudo, but it’s still pointless. Just install it normally, with pacman.

A few things:

  • Installing the the yt-dlp binary won’t actually solve the core problem. There will just be issues next time some other python package is updated.
  • yt-dlp when downloaded from the author is a self contained zipimport binary so it should have minimal dependencies
  • Running sudo yt-dlp is not common sense, it is a terrible practice. If you desire to use the self-updating binary, place it somewhere you have rights to write like in your home directory.
2 Likes