How to install Python package from GitHub? [duplicate] - python

This question already has answers here:
Configuring so that pip install can work from github
(8 answers)
Closed 6 years ago.
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

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.

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

Related

Local repository for *.whl files python [duplicate]

This question already has answers here:
How to setup pip to download from mirror repository by default?
(2 answers)
Closed 5 months ago.
I'm new to python and I need to install *.whl files locally from some folder (repository). I can install *whl like by using the command pip install path_to_file/*.whl, but this is not I want, what I do want is to write pip install some_whl_package and install the package specified from LOCAL directory. How can I do it? I use python 3.8.
Note that the dist folder must contain the whl file.you can also install .tar.gz packages like this
pip install --no-index -f ./dist my_package.whl

A question about pip install vs python setup.py install

What is the main difference in installing a python package by pip install and python setup.py install using the file from GitHub repository?
From what I understand right now, I kinda have the feeling that using the second option you will install the repo in some sort of developer mode where you can do changes by directly operating in the files cloned by git repo. Is this correct? I would like to find out a proper explanation of this.

How to see what packages are required to install another package? [duplicate]

This question already has answers here:
List dependencies of Python wheel file
(7 answers)
Closed 3 years ago.
I want to install many packages on an offline computer, I download and install manually using the following code:
pip install XXXXX.whl --user
Although the code above does the offline installation, the package needs other packages so it tries to connect to the internet. I can see what package it is looking for. So, I will download manually and again install that. If there are a lot of packages required, it becomes overwhelming.
Any better solution? Can I know from the beginning that what packages have to be downloaded for installing my package?
Do you use anaconda?
Make a conda environment on your online pc and install all your packages you need.
Then check with
'''
conda list
'''
What packages you need.

Install a python package in a virtual environment directly from git [duplicate]

This question already has answers here:
pip install from git repo branch
(8 answers)
Closed 5 years ago.
I have a python package I want to use, but it appears that the version installed through pip is seriously outdated, to the point where example code doesn't work. some research independently verified that in order to get the code to work properly, I need the latest version from git.
How do I install a python package from within a virtual environment directly from git without going through pip?
Alternatively, since I don't know too much about pip, if this should never be necessary, then how do I force pip to install the latest version on github?
You'll want to reference this documentation.
Here's the basic format:
pip install -e vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir
In the case of git it'd be something like
pip install -e git+https://www.github.com/name_your_project/name_your_repo

How to use Python Pip install software, to pull packages from Github?

I'm trying to install a package from Github, using Pip, using the following syntax
pip install -e git+https://github.com/facebook/python-sdk.git#egg=FacebookSDK
and getting the error "cannot find command git". This Question has (unchecked) answers saying that Git needs to be installed on the system. However, this Answer states that "Git, Subversion, Bazaar and Mercurial are all supported" by Pip.
The Pip documentation also says it has "Native support for other version control systems (Git, Mercurial and Bazaar)".
So how do I install this package with Pip? I really don't want to install Git on my VPS. Or are there any non-Pip tools, for just pulling files from repositories (without doing a full Git install)?
Update - so I bit the bullet, and installed Git on my VPS. Pip still wasn't able to grab the package, but it was giving a different set of errors, so - progress. :) I finally did
git clone http://github.com/facebook/python-sdk.git
(note the http, not https), and manage to download the package, then just installed it manually.
If I'm not mistaken, you would need the git client to be install on your machine. In the event that you don't have git installed, try this:
pip install https://github.com/facebook/python-sdk/zipball/master
or
pip install https://github.com/facebook/python-sdk/tarball/master
You need to install the git-core, since the git:// protocol isn't associated with anything.
sudo apt-get install git-core
For Windows or none git users:
I first download and unpack the file.
Then in the python directory going to \Scripts
Starting here the command prompt (shift + rigth-click)
pip install C:\Theano-master
*# replace Theano-master with the path to your directory of your package
This morning, when I run python pip to install a pcakge from git has problems.
pip install git+https://github.com/gumblex/zhconv.git#egg=zhconv
Firstly get error msg:
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
Try pip install git
ERROR: Could not find a version that satisfies the requirement git
ERROR: No matching distribution found for git
When I find this question,tried answers from #Mridang Agarwalla not work for first one; for second cmd, there was "time out" to git site.
But when trying answer from #Martijn van Wezel, it is very successfully. Thanks! #Martijn van Wezel
My trying is:
download the Zip file i need from Git page and extract it to a folder.
https://github.com/gumblex/zhconv
extract the ZIP to my local folder: D:\gitPackageforinstall\zhconv
Then success by below cmd.
pip install D:\gitPackageforinstall\zhconv
Hope this could be a reference to others as an update for 20210419
I'm learning about PostgreSQL and had to install the windows version. It was suggested to use git+, and I was running to the same issues that John C was experiencing.
Martijn above recommended unpacking and downloading. That is also what the creators of win-psycopg suggested. So I thought I'd share their method for installing into a Virtual Environment.
Thank you stickpeople:
http://www.stickpeople.com/projects/python/win-psycopg/
To install into a virtual env:

Categories