I Can't Get YouTube-DL to Work

SpongebobFan1994

Active Member
Credits
2,118
I was trying to download some videos just now, but every time I do so, I get an error message saying "/usr/bin/env: ‘python’: No such file or directory". I have YouTube-DL installed on Mint 20.1 (which ironically worked perfectly when I was still using 19.3), so I don't know what the problem is. Could this be common with 20.1?
 


f33dm3bits

Gold Member
Gold Supporter
Credits
16,567
Sounds like python is not installed, run the first command if you don't get any output also run the second command and then try using youtube-dl again.
Code:
which python3
sudo apt install python3-minimal
 

Condobloke

Well-Known Member
Credits
10,121
sudo pip install --upgrade youtube_dl

Run that in Terminal. This command will update youtube-dl if you have already installed it
 

Condobloke

Well-Known Member
Credits
10,121
where did you download it from originally ?
 

Condobloke

Well-Known Member
Credits
10,121

SpongebobFan1994

Active Member
Credits
2,118
@Condobloke

Mint's software manager. After going to that link you showed me, and trying each series of commands, I checked the signature type. When I got to "gpg --verify youtube-dl.sig /usr/local/bin/youtube-dl", I got an error message saying
"gpg: keybox '/home/david/.gnupg/pubring.kbx' created
gpg: Signature made Sun 25 Apr 2021 01:34:43 PM CDT
gpg: using RSA key ED7F5BF46B3BBED81C87368E2C393E0F18A9236D
gpg: Can't check signature: No public key"
 

gvisoc

Active Member
Credits
1,508
You need to add the public key of the developer to your keyring. In the YouTube-dl page, search for instructions re. PGP signature. It will get you through to a page from where you can download the signing public key (the one for “Sergei M.”) and follow these instructions. Then, try again to verify.
 

SpongebobFan1994

Active Member
Credits
2,118
@gvisoc

If the instructions are where it says "The following GPG keys will be used to sign the binaries and the git tags:", I saved Sergei's key, and then I try copying and pasting it into the keyserver, I'm told "Not found". I'm honestly confused.
 

gvisoc

Active Member
Credits
1,508
EDIT: redact developer’s email

Indeed, I was trying to get it sorted out as I think the instructions I pasted are to import keys from a keyserver, and I couldn't find Sergei's, so I downloaded it and imported it manually.

This is what I executed in order to try the process and check the signature with no issues (not on the process but yes in the result! see below):
Code:
wget https://dstftw.github.io/keys/18A9236D.asc -O 18A9236D.asc
pip install --upgrade youtube-dl
wget https://yt-dl.org/downloads/2021.04.26/youtube-dl.sig -O youtube-dl.sig
gpg --import 18A9236D.asc
gpg --verify ./youtube-dl.sig $(which youtube-dl)
The first URL is a right click + copy URL from the browser, over Sergei M's.

The problem is that Sergei's key doesn't verify against the pip version of youtube-dl (says BAD signature), so I'm uninstalling it as untrusted.

Code:
gpg: Signature made Mon 26 Apr 2021 04:34:43 AEST
gpg:                using RSA key ED7F5BF46B3BBED81C87368E2C393E0F18A9236D
gpg: BAD signature from "Sergey M. <REDACTED EMAIL>" [unknown]
But try against Mint's package anyay, it may be good.
 
Last edited:

gvisoc

Active Member
Credits
1,508
FWIW, I opened an issue to the project for them to fix. Bad signatures can mean just errors, or package tampering (malware,...). That's why I always use pip without sudo, which stores the executable under ~/.local
 

f33dm3bits

Gold Member
Gold Supporter
Credits
16,567
@f33dm3bits

I tried that and it didn't work
It works on my Mint vm so you must be missing a python package or something like that. What's python packages do you have installed, can you share the output of the following?
Code:
which python3
dpkg --list | awk -F" " '{ print $2 }' | grep ^python
What does the first line of /usr/bin/youtube-dl look like?
 
Last edited:

craigevil

Active Member
Credits
769
sudo apt install python-is-python3

That is what I had to do to get it working. I had the same errors as the OP.
 

Tolkem

Well-Known Member
Credits
5,549
I was trying to download some videos just now, but every time I do so, I get an error message saying "/usr/bin/env: ‘python’: No such file or directory".
This error means that youtube-dl is defaulting to python as in python2 which is no more. Run this command
Code:
sudo nano /usr/bin/youtube-dl
you should see
Code:
#!/usr/bin/python3
if you instead see this
Code:
#!/usr/bin/env python
as in here https://github.com/rbrito/pkg-youtube-dl/blob/master/bin/youtube-dl which is where Mint gets the pkg, and it's from 2020, also last github commit was in 2019, so most likely it is indeed looking for python2 and like I said it is deprecated. You might try changing that line so it points to python3, I'm not really sure whether that will work though, or you might try installing this one http://archive.ubuntu.com/ubuntu/ub...ube-dl/youtube-dl_2021.04.07-0ubuntu1_all.deb and see if it works as it has that line set properly pointing to python3. Note that this pkg is for Ubuntu 21.04, and I think your Mint's version is based on 20.04. However, I think it will work as all it needs is python3, which should be installed in MInt.
 

gvisoc

Active Member
Credits
1,508
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Staff online

Members online


Latest posts

Top