339

I want to use a new feature of httpie. This feature is in the github repo https://github.com/jkbr/httpie but not in the release on the python package index https://pypi.python.org/pypi/httpie

How can I install the httpie package from the github repo? I tried

pip install https://github.com/jkbr/httpie

But I got an error 'could not unpack'


In Nodejs, I can install packages from github like this

npm install git+https://github.com/substack/node-optimist.git
1

2 Answers 2

541

You need to use the proper git URL:

pip install git+https://github.com/jkbr/httpie.git#egg=httpie

Also see the VCS Support section of the pip documentation.

Don’t forget to include the egg=<projectname> part to explicitly name the project; this way pip can track metadata for it without having to have run the setup.py script.

6
  • 79
    Another installation option that doesn't require Git installed: pip install --upgrade https://github.com/jkbr/httpie/tarball/master Mar 7, 2013 at 15:35
  • This also solved a problem for me installing a git-hosted package on www.pythonanywhere.com
    – Arj
    Jun 7, 2015 at 14:04
  • Can I choose a branch?
    – Nicofisi
    Dec 21, 2017 at 14:20
  • 14
    @Nicofisi: yes, with @<branchname> appended to the URL. See the VCS support documentation.
    – Martijn Pieters
    Dec 21, 2017 at 17:46
  • 1
    @Konrad After tarball comes the reference. master is the name of the most common default branch, but the reference doesn’t have to be a branch name. You can also use tags or the SHA of a specific commit. Look at the specific repository to see what branches and tags they have.
    – Martijn Pieters
    Apr 3, 2022 at 20:00
132

To install Python package from github, you need to clone that repository.

git clone https://github.com/jkbr/httpie.git

Then just run the setup.py file from that directory,

sudo python setup.py install
7
  • 15
    too often a python github repo does not have a setup.py file ... see github.com/tyiannak/pyAudioAnalysis Nov 12, 2017 at 14:49
  • 16
    pip install . from the locally cloned repo dir will work too.
    – ccpizza
    Jun 3, 2018 at 19:33
  • @ccpizza Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
    – techkuz
    Feb 27, 2019 at 6:54
  • 4
    @trthhrtz: this means that the package is not compliant and does not meet the requirements as defined in packaging.python.org/guides/…
    – ccpizza
    Feb 27, 2019 at 6:59
  • 8
    Install it in develop mode WITHOUT sudo: run pip install -e . from inside the root dir of the cloned repo There 2 benefits ot this solution: 1. You can install package in your home projects directory. 1. Package includes .git dir, so it's regular Git repository. You can push to your fork right away. [credit for this a goes to @avalanchy from the referred question]
    – ntg
    Feb 14, 2020 at 9:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.