8

I suffer a strange behaviour of pip. Calling

pip install git+https://github.com/username/repo

generally works, but on some packages it fails in an abnormal way

Downloading/unpacking git+git://github.com/artscoop/django-inplaceedit
  Cloning git://github.com/artscoop/django-inplaceedit to /tmp/pip-rl1_7G-build
  Running setup.py egg_info for package from git+git://github.com/artscoop/django-inplaceedit

Installing collected packages: django-inplaceedit
  Running setup.py install for django-inplaceedit

    error: Error: setup script specifies an absolute path:

        /tmp/pip-rl1_7G-build/AUTHORS.rst

    setup() arguments must *always* be /-separated paths relative to the
    setup.py directory, *never* absolute paths.

    Complete output from command /home/steve/virtualenv/project/bin/python -c "import setuptools;__file__='/tmp/pip-rl1_7G-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vVDBRe-record/install-record.txt --single-version-externally-managed --install-headers /home/steve/virtualenv/project/include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/urls.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/views.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/perms.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/__init__.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/fields.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/adaptors.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/commons.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/tag_utils.py -> build/lib.linux-x86_64-2.7/inplaceeditform

creating build/lib.linux-x86_64-2.7/inplaceeditform/templatetags

copying inplaceeditform/templatetags/__init__.py -> build/lib.linux-x86_64-2.7/inplaceeditform/templatetags

copying inplaceeditform/templatetags/inplace_edit.py -> build/lib.linux-x86_64-2.7/inplaceeditform/templatetags

running egg_info

creating django_inplaceedit.egg-info

writing django_inplaceedit.egg-info/PKG-INFO

writing top-level names to django_inplaceedit.egg-info/top_level.txt

writing dependency_links to django_inplaceedit.egg-info/dependency_links.txt

writing manifest file 'django_inplaceedit.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



reading manifest template 'MANIFEST.in'

writing manifest file 'django_inplaceedit.egg-info/SOURCES.txt'

error: Error: setup script specifies an absolute path:



    /tmp/pip-rl1_7G-build/AUTHORS.rst



setup() arguments must *always* be /-separated paths relative to the

setup.py directory, *never* absolute paths.



----------------------------------------
Command /home/steve/virtualenv/project/bin/python -c "import setuptools;__file__='/tmp/pip-rl1_7G-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vVDBRe-record/install-record.txt --single-version-externally-managed --install-headers /home/steve/virtualenv/project/include/site/python2.7 failed with error code 1 in /tmp/pip-rl1_7G-build
Storing complete log in /home/steve/.pip/pip.log

setuptools-git is obviously installed, and I found zero information on this bug, though I've been struck by this a dozen times. I can't find why it complains of having absolute paths since it's the one generating them.

Steve K
  • 10,879
  • 4
  • 39
  • 39
  • This works in my machine, this sudo pip install git+git://github.com/Yaco-Sistemas/django-inplaceedit and this sudo pip install git+git://github.com/artscoop/django-inplaceedit – Goin Sep 18 '13 at 11:00
  • 2
    Oh, I forgot about this. Actually this is an error caused by the new version of Setuptools (1.0) uploaded on the PyPI. More than 50% of the packages I wanted to install failed, not only inplaceedit (which I'm using without any problem). The author has a Github repo, but does not accept issue tracking, and does not reply to emails. So I had to force using setuptools 0.3, or something like that. – Steve K Sep 18 '13 at 18:54
  • For anyone facing this issue today, setuptools==10.0.1 works – nerraruzi Feb 01 '17 at 12:39

3 Answers3

11

This is caused by an absolute path specified in a SOURCES.txt file within the project's egg-info, if include_package_data=True is present in setup.py. In this case, 'django_inplaceedit.egg-info/SOURCES.txt' contains the string /tmp/pip-rl1_7G-build/AUTHORS.rst, an invalid absolute path. Under some circumstances either pip and/or setuptools may put in the full path of a file from a source tree into it. I have not been able to effectively reproduce this yet, but I suspect the include_package_data flag in setup.py aggravates this issue. To fix, simply just nuke that SOURCES.txt file in the egg-info directory and rerun setup.py install again from the source directory.

metatoaster
  • 17,419
  • 5
  • 55
  • 66
  • 1
    Upvoted this one because I was able to have `include_package_data=True` after removing the `.egg-info`dir with absolute path in it and regenerating it. – Pierre.Sassoulas Dec 20 '18 at 09:50
  • how to find that `SOURCES.txt` file? – Gulzar Dec 13 '22 at 10:55
  • 1
    @Gulzar in the same place with the `.egg-info` directory (not sure how this isn't apparent in the answer given), typically this is adjacent to the top level source directory, e.g. at the project root or inside `./src`. Generally this file (and `.egg-info`) is not present in a source check-out but may be present with source archives generated by `setup.py sdist`. Also if you searched in a search engine for `egg-info python site:stackoverflow.com` you should have came across [this thread](https://stackoverflow.com/questions/58561840/whats-the-purpose-of-package-egg-info-folder). – metatoaster Dec 13 '22 at 23:33
4

I was facing the same error and fixed it by commenting out

include_package_data=True

in setup.py module

General Failure
  • 2,421
  • 4
  • 23
  • 49
mjabei
  • 41
  • 1
  • I resolved the issue by commenting `include_package_data=True` in setup.cfg file. It was mentioned under [options]. However, I do not understand why should that throw the error. – Gaurav Srivastava Feb 20 '22 at 00:29
-1

In my case, the solution to this problem was that my MANIFEST.ini file contained the static path (it wasn't being created on accident, nuking the old egg didn't help):

wrong:

recursive-include resources /*.*

right:

recursive-include resources *.*

BobbiMcRobbi
  • 64
  • 1
  • 2