installing a Python package source tarball with pip

lebedov picture lebedov · Dec 20, 2011 · Viewed 17k times · Source

I'm trying to figure out how to construct a Python source package that is installable via pip. I tried creating a test project with the setup.py file described on http://packages.python.org/an_example_pypi_project/setuptools.html and a number of simple test files in the specified directories.

After creating a source tarball for the project named dist/an_example_pypi_project-0.0.4.tar.gz with python setup.py sdist, I tried installing it in a virtualenv environment called ~/TEST with ~/TEST/bin/pip install dist/an_example_pypi_project-0.0.4.tar.gz. Although pip didn't throw any error, it didn't seem to install the package:

$ ~/TEST/bin/pip install dist/an_example_pypi_project-0.0.4.tar.gz 
Unpacking ./dist/an_example_pypi_project-0.0.4.tar.gz
  Running setup.py egg_info for package from file:///home/lebedov/an_example_pypi_project/dist/an_example_pypi_project-0.0.4.tar.gz

Cleaning up...
$ find ~/TEST -name "an_example*"
$

Note that I was able to install from the tarball using easy_install:

$ ~/TEST/bin/easy_install dist/an_example_pypi_project-0.0.4.tar.gz 
Processing an_example_pypi_project-0.0.4.tar.gz
Running an_example_pypi_project-0.0.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-tfXxeW/an_example_pypi_project-0.0.4/egg-dist-tmp-N2QY_N
warning: build_py: byte-compiling is disabled, skipping.

warning: install_lib: byte-compiling is disabled, skipping.

zip_safe flag not set; analyzing archive contents...
Adding an-example-pypi-project 0.0.4 to easy-install.pth file

Installed /home/lebedov/TEST/lib/python2.7/site-packages/an_example_pypi_project-0.0.4-py2.7.egg
Processing dependencies for an-example-pypi-project==0.0.4
Finished processing dependencies for an-example-pypi-project==0.0.4
$ find ~/TEST/ -name "an_example*"                                  
/home/lebedov/TEST/lib/python2.7/site-packages/an_example_pypi_project-0.0.4-py2.7.egg

Am I neglecting to configure something in the package in order to make it installable with pip? I'm using Python 2.7.2, distribute 0.6.21, virtualenv 1.7, and pip 1.0.2.

Answer

Mu Mind picture Mu Mind · Feb 23, 2012

The bug report you posted on github had excellent instructions to reproduce. (I commented on the ticket and copied the response here.)

I followed those instructions to the letter using those exact versions of the packages you listed and still can't reproduce this issue.

Here's my output from pip install --verbose for the command in question:

Unpacking ./dist/anyjson-0.3.1.tar.gz
  Running setup.py egg_info for package from file:///home/david/projects/anyjson-0.3.1/dist/anyjson-0.3.1.tar.gz
    running egg_info
    creating pip-egg-info/anyjson.egg-info
    writing pip-egg-info/anyjson.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/anyjson.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/anyjson.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/anyjson.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/anyjson.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pip-egg-info/anyjson.egg-info/SOURCES.txt'
Installing collected packages: anyjson
  Running setup.py install for anyjson
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-i686-2.7
    creating build/lib.linux-i686-2.7/anyjson
    copying anyjson/__init__.py -> build/lib.linux-i686-2.7/anyjson
    running install_lib
    creating /tmp/TEST/lib/python2.7/site-packages/anyjson
    copying build/lib.linux-i686-2.7/anyjson/__init__.py -> /tmp/TEST/lib/python2.7/site-packages/anyjson
    byte-compiling /tmp/TEST/lib/python2.7/site-packages/anyjson/__init__.py to __init__.pyc
    running install_egg_info
    running egg_info
    writing anyjson.egg-info/PKG-INFO
    writing top-level names to anyjson.egg-info/top_level.txt
    writing dependency_links to anyjson.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'anyjson.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'anyjson.egg-info/SOURCES.txt'
    Copying anyjson.egg-info to /tmp/TEST/lib/python2.7/site-packages/anyjson-0.3.1-py2.7.egg-info
    running install_scripts
    writing list of installed files to '/tmp/pip-gvBT02-record/install-record.txt'
Successfully installed anyjson
Cleaning up...

Maybe you could add --verbose to your pip install command and post the output for comparison?