How to install *latest* yt-dlp on Ubuntu Server 24.04.1 LTS?

Keith keithw at caramail.com
Mon Feb 10 21:38:19 UTC 2025


On 2/10/2025 1:51 PM, Bo Berglund wrote:
> My Ubuntu Server 24.04.1 LTS PRO is installed from scratch a few weeks ago and
> it is tasked with all of my video work as well as a set of other jobs too.
> 
> The version of yt-dlp I have installed via apt does not work fully on Youtube, I
> sometimes get "error: externally-managed-environment" during download.
> 
> I found a how-to for getting the latest version of yt-dlp here:
> https://www.spacebar.news/how-to-install-yt-dlp/
> 
> So I tried it on my Windows 10 PC first and when done it actually worked without
> errors to download the problem video from YT. :-)
> 
> So far so good, but I need this on my *server* where I am doing all of my video
> handling and here the suggested installation method fails...
> 
> What I did is this:
> 1) sudo apt remove yt-dlp #To ensure no interference
> 
> 2) sudo apt install python3 python3-pip ffmpeg
>     (I already had these but now for sure at the latest versions)
> 
> 3) python3 -m pip install -U "yt-dlp[default]"
>     error: externally-managed-environment
>     plus a long block of text:
> 
> × This environment is externally managed
> ?-> To install Python packages system-wide, try apt install
>      python3-xyz, where xyz is the package you are trying to
>      install.
> 
>      If you wish to install a non-Debian-packaged Python package,
>      create a virtual environment using python3 -m venv path/to/venv.
>      Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
>      sure you have python3-full installed.
> 
>      If you wish to install a non-Debian packaged Python application,
>      it may be easiest to use pipx install xyz, which will manage a
>      virtual environment for you. Make sure you have pipx installed.
> 
>      See /usr/share/doc/python3.12/README.venv for more information.
> 
> I don't understand this explanation but wonder what I could do now that the
> cook-book command did not work?
> 
> And I have never programmed in python so I don't know how that is done either.
> 
> 

Unless you're wanting to gain experience with installing python programs 
in a python virtual environment (there's plenty of howto's for that), 
I'd forgo doing that and either download the yt-dlp static binary and 
stick it in /usr/local/bin:

https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux

or use the PPA listed so that you can install via APT:

https://github.com/yt-dlp/yt-dlp/wiki/Installation#apt

or via Snap package:

https://github.com/yt-dlp/yt-dlp/wiki/Installation#snap.

-- 
Keith




More information about the ubuntu-users mailing list