pip install错误:安装脚本指定绝对路径

时间:2013-08-06 16:27:03

标签: django pip setuptools

我遭受了pip的奇怪行为。 调用

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

通常有效,但在某些软件包上以异常方式失败

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,我发现了关于这个bug的信息,尽管我已经被这个打了十几次。 我无法找到它为什么抱怨拥有绝对路径,因为它是产生它们的路径。

3 个答案:

答案 0 :(得分:8)

这是由项目的egg-info中的SOURCES.txt文件中指定的绝对路径引起的,如果include_package_data=True中存在setup.py。在这种情况下,'django_inplaceedit.egg-info/SOURCES.txt'包含字符串/tmp/pip-rl1_7G-build/AUTHORS.rst,这是一个无效的绝对路径。在某些情况下,pip和/或setuptools可能会将文件的完整路径从源树放入其中。我还没有能够有效地重现这一点,但我怀疑include_package_data中的setup.py标志会加剧这个问题。要修复,只需在egg-info目录中查看SOURCES.txt文件,然后再从源目录重新运行setup.py install

答案 1 :(得分:3)

我遇到了同样的错误并通过评论

修复了它
include_package_data=True
setup.py模块中的

答案 2 :(得分:0)

以我为例,该问题的解决方案是我的MANIFEST.ini文件包含静态路径(不是偶然创建的,对旧鸡蛋不利无益):

错误:

recursive-include resources /*.*

右:

recursive-include resources *.*