0

I downloaded the youtube_dl python package and want to use it in my python program as in this question:

How to use youtube-dl from a python program?

The problem is that youtube-dl often needs to update, but I need my program to be distributed as standalone executable (PyInstaller) and I don't know if the python package can update itself. Because the standard way to update is:

pip install --upgrade youtube_dl

If it can't update itself, I would have to call youtube-dl.exe via subprocess.run().

So the question is: can the youtube_dl python package update itself automatically? Or more specifically, can it update itself when it's bundled into executable using PyInstaller?

MichalH
  • 1,062
  • 9
  • 20

1 Answers1

1

No. You have to update it, and then recompile the exe file with pyinstaller.

The exe is a set of frozen bits that must be manually rebuilt with their associated dependencies.

JacobIRR
  • 8,545
  • 8
  • 39
  • 68
  • Ok makes sense, and do you know if it can update itself when it's not in exe? Or do I have to use `pip install --upgrade`? – MichalH Dec 08 '20 at 21:32
  • The notion of self updating packages can be an anti pattern and security risk IMO. You can make a cron script or scheduled task to run that pip command every minute or so on your machine if you wanted to do that. This would at least poll for updates without manual work. – JacobIRR Dec 08 '20 at 23:37
  • Ok but I will share the app with other people, so I guess the easiest for now is to directly download and use `youtube-dl.exe` in my script. Thanks. – MichalH Dec 09 '20 at 12:21