How to manually install a pypi module without pip/easy_install?


Question

I want to use the gntp module to display toaster-like notifications for a C/C++ software. I want to package all the dependencies for the soft to be self-executable on a another computer.

The gntp module is only available through the pip installer, which cannot be used (The computer which is running the soft do not have any internet connection) : how can I install it from the sources ?

I would prefer not to force the user to install easy_install/pip and manually add the pip path to the %PATH.

PS : I'm using Python 2.7 on a Windows machine.

1
66
11/7/2012 4:29:26 PM

Accepted Answer

  1. Download the package
  2. unzip it if it is zipped
  3. cd into the directory containing setup.py
  4. If there are any installation instructions contained in documentation contianed herein, read and follow the instructions OTHERWISE
  5. type in python setup.py install

You may need administrator privileges for step 5. What you do here thus depends on your operating system. For example in Ubuntu you would say sudo python setup.py install

EDIT- thanks to kwatford (see first comment)

To bypass the need for administrator privileges during step 5 above you may be able to make use of the --user flag. In this way you can install the package only for the current user.

The docs say:

Files will be installed into subdirectories of site.USER_BASE (written as userbase hereafter). This scheme installs pure Python modules and extension modules in the same location (also known as site.USER_SITE). Here are the values for UNIX, including Mac OS X:

More details can be found here: http://docs.python.org/2.7/install/index.html

107
11/7/2012 4:29:23 PM

To further explain Sheena's answer, I needed to have setup-tools installed as a dependency of another tool e.g. more-itertools.

Download

Click the Clone or download button and choose your method. I placed these into a dev/py/libs directory in my user home directory. It does not matter where they are saved, because they will not be installed there.

Installing setup-tools

You will need to run the following inside the setup-tools directory.

python bootstrap.py
python setup.py install

General dependencies installation

Now you can navigate to the more-itertools direcotry and install it as normal.

  1. Download the package
  2. Unpackage it if it's an archive
  3. Navigate (cd ...) into the directory containing setup.py
  4. If there are any installation instructions contained in the documentation contained herein, read and follow the instructions OTHERWISE
  5. Type in: python setup.py install

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon