I want pip to install from the latest commit on a master branch of my github repository. I tried many options mentioned here on StackOverflow, none helped. For instance, that does not work:
pip install --upgrade --force-reinstall pathToGithubRepo
I want pip to install from the latest commit on a master branch of my github repository. I tried many options mentioned here on StackOverflow, none helped. For instance, that does not work:
pip install --upgrade --force-reinstall pathToGithubRepo
Using numpy's repository as an example.
If you know the hash of the commit you are interested in, you can use the following command:
$ pip install -e git+https://github.com/numpy/numpy.git@75b2d5d427afdb1392f2a0b2092e0767e4bab53d#egg=numpy
where 75b2d5d427afdb1392f2a0b2092e0767e4bab53d
is the latest commit for the numpy repository, and numpy
is the project name used by egg for pip to figure out dependencies.
If you want to also automatically get the latest commit hash, you can use the command:
$ git ls-remote git@github.com:numpy/numpy.git | head -1 | awk '{print $1;}'
75b2d5d427afdb1392f2a0b2092e0767e4bab53d
Unix wasn't invented for nothing, let's combine it into one big command:
$ pip install -e git+https://github.com/numpy/numpy.git@$(git ls-remote git@github.com:numpy/numpy.git | head -1 | awk '{print $1;}')#egg=numpy
Replace numpy with your repository url and project name, and you're set.
You could use the flag --no-cache-dir
to temporarily disable the cache and avoid installing from an already cached download, instead forcing a download of the most recent commit. (link to documentation)
This would look like
pip install --upgrade --no-cache-dir [path to package location]
Using the Chardet package as an example, this could look like:
pip install --upgrade --no-cache-dir https://github.com/chardet/chardet/archive/refs/heads/master.zip