'How to install a .zip package via requirements.txt?

I've got URL similar tohttps://github.com/me/my-project/archive/master.zip

During development, I was able to install it with:

pip install https://github.com/me/my-project/archive/master.zip

How would I go about adding that to requirements.txt? I can only see options for repositories.

Thanks.



Solution 1:[1]

I found out! This needs to be added to requirements.txt:

-e git+https://github.com/me/my-project/#egg=my-project

Previously I was using a different VCS tag which was giving me some funky errors.

Solution 2:[2]

The accepted answer didn't work for me only because the package I am using needs to be installed directly from a zip that's been downloaded from github.

But, this worked for me:

from pip._internal import main as pipmain
pipmain(['install', 'package-downloaded-from-github-master.zip'])

Which I got from here: How can I install a github zip file with pip and setup.py from requirements.txt?

Solution 3:[3]

Without third-party dependencies out of the box, you can do this by simply adding the following line to requirements.txt:

my-project @ https://github.com/me/my-project/archive/master.zip

Solution 4:[4]

Not sure how to achive this via Pip

I can suggest, if you aren't able to find any solutions this way, to use pipenv.

Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a first-class citizen, in our world.
It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever-important Pipfile.lock, which is used to produce deterministic builds.

Pipenv on Github: https://github.com/pypa/pipenv

Hope it helps
Hele

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 E. Edwards
Solution 2 ChrisDanger
Solution 3 Kirill Vercetti
Solution 4 Hele