I have recently had some issues installing youtube-dl on Ubuntu 20.04. THIS IS NOT THE SAME QUESTION. Those issues have been resolved, but I am not:
- a Python user
- comfortable with
snapyet
And it seems the apt repository is not maintaining a current, operational version of youtube-dl, so my preferred approach won't work.
It seems that installing youtube-dl from source would be a good solution. I've not done this on Ubuntu, and have very limited experience on any plaform. I've found what appears to be a decent guide, but nothing specific for youtube-dl on Ubuntu. Is there anything else I should know before proceeding?
Other Notes (Edit):
Just to confirm that sudo apt-get install youtube-dl has issues:
Preparing to unpack .../12-youtube-dl_2020.03.24-1_all.deb ...
Unpacking youtube-dl (2020.03.24-1) ...
Setting up youtube-dl (2020.03.24-1) ...
After the apt installation of youtube-dl completes successfully:
$ which youtube-dl
/usr/bin/youtube-dl
$ youtube-dl --version
bash: /usr/local/bin/youtube-dl: No such file or directory
$ /usr/bin/youtube-dl --version
2020.03.24
Which suggests to a newbie such as I that something is amiss. Note that there is confusion wrt where youtube-dl is installed: /usr/bin vs /usr/local/bin. And it clearly installs an old (March, 2020) version.
Using the install procedure from the youtube-dl github page yields this:
$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl
$ youtube-dl --version
/usr/bin/env: ‘python’: No such file or directory
For reasons unclear to me, the youtube-dl maintainers want the installation in /usr/local/bin. No idea why python is expected in /usr/bin/env.
All the above is to address various comments made since this Q was submitted.
And yes, if I uninstall/remove/reverse the apt install, and delete the curl'd d/l to /usr/local/bin, I can successfully install and run youtube-dl using sudo pip3. But some caution that sudo pip3 should NOT be done - rather it should be virtualenv (or something like that) instead. That is why I have posted this question: I don't want to use something I don't don't use & don't understand because I can't maintain it. I don't think that's unreasonable or makes me recalcitrant. I just want to know how to install youtube-dl from source - if that is a reasonable thing to do given all of the above.
aptinstalled2020.11.21.1version (you're likely to have a different version if your release differs). Why not justpip3install it as Gunnar Hjalmarsson suggested. It's worked for me in the past. – guiverc Nov 29 '20 at 05:35youtube-dland the upgraded package usually is available 28-52 hours later (as it's community packaged, it's a volunteer in their own time packaging it, and delays can occur, but the process is started with bug filing) – guiverc Nov 29 '20 at 05:38youtube-dlfrom theaptrepo, and got a version from March of this year. And being installed fromapt, it must be upgraded via apt. – deWalker Nov 29 '20 at 05:53pip3 install youtub-dlI don't consider difficult, which you mentioned but also highlighted an issue... I'll see if I can find a recent 20.04.2 QA-test install & have a play for you. – guiverc Nov 29 '20 at 06:06sudo apt install python3-pip, followed bypip3 install youtube-dl, nextsudo ln -s /home/guiverc/.local/bin/youtube-dl /usr/local/bin/youtube-dlso it can be found (it's quick) then ayoutube --versionreports the version as2020.11.26which is not the version you got in your prior question. It works too downloading a youtube video. – guiverc Nov 29 '20 at 06:15df& like commands checking out the Quality Assurance install of the un-released Lubuntu 20.04.2 system; in reality it's just a 20.04 system. and I can't see Lubuntu making any difference; it was used as available), but I don't see that as anything beyond what has already been covered in your prior question.--upgradedoesn't make sense on a first install in your question so I didn't use it; my use oflncould be done other ways; but I find that way quick so used it.. – guiverc Nov 29 '20 at 06:27pip3install did not get the2020.11.26ver ofyoutube-dlthen I have mis-communicated. I think I said it worked in this question, and I accepted the answer I got on the previous question. Yes... it works, but as explained in my Edit, I don't want to use that solution. I think between Ubuntu & yt-dl, something is broken. It seems that installing from source may be a solution, but I don't know - thus, the question. – deWalker Nov 29 '20 at 07:20pip3 install youtub-dlwill install the source (a python3 script). You can then usewhereisto locate where it was placed (I may have usedwhereisbefore I use thelnin prior comment), then afilecan be used to confirm it's python3. eg. afile ..../youtube-dlreports "Python script, ASCII text executable" (ie. that is the source code; python3 is both source code & executable). I dropped (....) the path as this is theaptinstaller version on this box (2020.11.21.1) so I wouldn't expect it to be the same path as pip3 installed version I tested on focal 20.04.2 box – guiverc Nov 29 '20 at 07:28youtube-dlis now an old version.... 2020.11.29 has come out... new versions ofyoutube-dlcome out very regularly ... the focal version I tested (prior comment) worked though on the music video *I download & subsequently listened to. – guiverc Nov 29 '20 at 07:35sudowhen you install withpip(and you really shouldn't because it's not necessary). You simply need to add the--userflag to yourpipcommand to install locally. After you install locally with pip for the first time, you will need to log out and log back in but this will not be necessary in the future. I have provided a simple answer below. – mchid Nov 29 '20 at 08:29lnthat local directory to /usr/local/bin so it can be found. You just need to log out and log back in after the first time you install something to$HOME/.local/binas this directory is conditionally added to your path (if it exists) by~/.profile. – mchid Nov 29 '20 at 09:01lncommand, just run the following commandrm $HOME/.local/bin/youtube-dland then follow my instructions below. – mchid Nov 29 '20 at 09:04lncommand was far quicker than logout/login (esp. given it took me ~4 goes to remember which password was used in that QA-test)... – guiverc Nov 29 '20 at 12:42/usr/local/binis so that the downloaded version will override the version fromapt. Also, if theaptversion is updated, it won't overwrite your downloaded version. Typically, applications installed from source or manually downloaded will install in/usr/local/binto allowaptversion to stay installed which you may need for dependency reasons (so that other packages don't break due to dependencies) although, that shouldn't be an issue here. – mchid Nov 29 '20 at 15:32