How to update a pip module with tarball or commit

The aim of this page📝 is to explain how to upgrade a pip module from Github-located tarball (.tar.gz file package) or a git commit. As an illustration, I am using the backage of ytdl.

Pavol Kutaj
2 min readSep 4, 2023

from a tarball

<!-- SYNTAX -->
python -m pip install https://github.com/<URL>.tag.gz

<!-- EXAMPLE -->
python -m pip install https://github.com/ytdl-org/ytdl-nightly/releases/download/2023.08.07/youtube-dl-2023.08.07.tar.gz
  • Go to a GitHub Repo ⟹ Releases ⟹ Get the package URL of the tar.gz

from a commit

<!-- SYNTAX -->
python -m pip install '<pip_module> @ git+https://<repo_url>@<commit_id>'

<!-- EXAMPLE -->
python -m pip install 'youtube-dl @ git+https://github.com/ytdl-org/ytdl-nightly@d88609d20f60ea9114a33c7ecacebdd6d135de74'
  • Go to a GitHub Repo ⟹ Find a commit to the main/master branch you want to install from
  • You need to know the name of the pip modul, it does not need to be identical with the URLs you’re going to be using
  • Find the name of <pip_module> with pip list command
  • The repo_url and the commit_id should be straightforwad, just mind the const values in the syntax (two @s, git+..., etc.)
  • For the mechanics of what pip’s doing, see https://adamj.eu/tech/2019/03/11/pip-install-from-a-git-repository/
  • This can be automated with say Powershell — the prereq is that you have already cloned the repository locally.
  • Once in $profile I just run update-ytdl to get the very latest version of the module in question.
# SYNTAX
function update-<module> {
cd "<repo_folder>"
git pull
$latest_SHA = git rev-parse HEAD
write-host "latest SHA: $latest_SHA"
python -m pip install "<module> @ git+https://<repo_URL>@$latest_SHA"
}
# EXAMPLE
function update-ytdl {
cd "C:\Users\Admin\tools\ytdl-nightly"
git pull
$latest_SHA = git rev-parse HEAD
write-host "latest SHA: $latest_SHA"
python -m pip install "youtube-dl @ git+https://github.com/ytdl-org/ytdl-nightly@$latest_SHA"
}

--force reinstall not very much working for me

<!-- SYNTAX -->
pip install --upgrade --force-reinstall "git+https://github.com/ytdl-org/youtube-dl.git"
<!-- EXAMPLE -->
pip install --upgrade --force-reinstall "git+https://github.com/ytdl-org/youtube-dl.git"

LINKS

--

--

No responses yet