securisec
securisec

Reputation: 4041

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

I am working with a library called lief which due to it lacking full python 3.7 support from pip, I need to install it from the following link https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.9.0.dev.zip.

The issue I am having is that it works fine when i do pip install https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.9.0.dev.zip, it works fine, but if i put that link in my requirements.txt file, it fails to install in travis with the error

error in rapido setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid requirement, parse error at "'://githu'"

Most of the examples I have seen about requirements.txt and github link points to a commit hash. How can I install a github zip file from requirements.txt so when i run pip install ., I am not getting the above mentioned error?

I should add that if i do pip install -r requirements.txt, it works fine, but if i do pip install -e . which uses setup.py, it will fail

Upvotes: 4

Views: 4053

Answers (1)

securisec
securisec

Reputation: 4041

As a stop gap measure, I am doing the following in my setup.py for anyone that runs into a similar problem. This works with pip install .

from pip._internal import main as pipmain
pipmain(['install', 'https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.9.0.dev.zip'])

But would really like to know if there is a more elegant way to do this using pip install . where the link is in requirements.txt.

Upvotes: 2

Related Questions