Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install Error: setup script specifies an absolute path

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.

like image 313
Steve K Avatar asked Aug 06 '13 16:08

Steve K


2 Answers

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.

like image 77
metatoaster Avatar answered Sep 28 '22 07:09

metatoaster


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

include_package_data=True

in setup.py module

like image 38
mjabei Avatar answered Sep 28 '22 07:09

mjabei