3

My question is similar to the following, but it does not completely address the problem I am facing: How can I update youtube-dl?

I have first tried this:

sudo youtube-dl -U

which gives the output:

It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.

As mentioned in the answer, I have tried upgrading it using pip:

sudo pip install --upgrade youtube-dl

It seems to have worked for many people. But for me it is giving the following error:

Installing collected packages: youtube-dl
  Found existing installation: youtube-dl 2016.2.22
Cannot uninstall 'youtube-dl'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Please instruct me on how to solve this issue and upgrade youtube-dl properly.

Note: this probably should have been asked in the comment section of the mentioned question, but unfortunately I am unable to comment there, so I had to post it as a new question.

Ahsan Tarique
  • 321
  • 3
  • 10
  • IMO, this should be its own question, not a comment. – wjandrea Jun 24 '18 at 19:36
  • How did you install `youtube-dl` in the first place? I'm guessing with APT, in which case you should uninstall it with APT: `sudo apt remove youtube-dl` then reinstall it another way. – wjandrea Jun 24 '18 at 19:42
  • Please try `if [ ! -z $(dpkg -l | grep youtube-dl) ]; then sudo apt-get remove --purge youtube-dl; fi; sudo -H pip install --upgrade youtube-dl` – cmak.fr Jun 24 '18 at 20:35
  • Thank you. I have posted an answer based on your comments. – Ahsan Tarique Jun 25 '18 at 12:23
  • 1
    Possible duplicate of [How can I update youtube-dl?](https://askubuntu.com/questions/380438/how-can-i-update-youtube-dl) – karel Jun 25 '18 at 14:03

1 Answers1

4

Thanks everyone for the insightful comments. As wjandrea and cmak.fr suggested, I tried removing youtube-dl first:

sudo apt remove youtube-dl

then reinstalled youtube-dl using pip:

sudo pip install youtube-dl

It installed the latest version of youtube-dl.

Ahsan Tarique
  • 321
  • 3
  • 10