【问题标题】:pip install Error: setup script specifies an absolute pathpip install 错误:安装脚本指定了绝对路径
【发布时间】:2013-08-07 18:40:20
【问题描述】:

我遭受了 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 显然已安装,我发现关于此错误的信息,尽管我已经被这个问题击中了十几次。 我找不到为什么它抱怨有绝对路径,因为它是生成它们的那个。

【问题讨论】:

  • 这适用于我的机器,这个 sudo pip install git+git://github.com/Yaco-Sistemas/django-inplaceedit 和这个 sudo pip install git+git://github.com/ artscoop/django-inplaceedit
  • 哦,我忘了这个。实际上这是由于 PyPI 上上传的新版 Setuptools (1.0) 导致的错误。我想安装的软件包中有超过 50% 失败了,不仅是 inplaceedit(我正在使用它没有任何问题)。作者有一个 Github repo,但不接受问题跟踪,也不回复邮件。所以我不得不强制使用 setuptools 0.3 或类似的东西。
  • 对于今天遇到此问题的任何人,setuptools==10.0.1 有效

标签: django pip setuptools


【解决方案1】:

就我而言,这个问题的解决方案是我的MANIFEST.ini 文件包含静态路径(它不是偶然创建的,对旧鸡蛋进行核对没有帮助):

错误:

recursive-include resources /*.*

右:

recursive-include resources *.*

?

【讨论】:

    【解决方案2】:

    我遇到了同样的错误并通过注释掉它来修复它

    include_package_data=True
    

    setup.py 模块中

    【讨论】:

      【解决方案3】:

      这是由项目的 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 可能会将来自源树的文件的完整路径放入其中。我还不能有效地重现这一点,但我怀疑setup.py 中的include_package_data 标志会加剧这个问题。要修复,只需在 egg-info 目录中删除 SOURCES.txt 文件,然后从源目录再次运行 setup.py install

      【讨论】:

      • 赞成这个,因为在删除带有绝对路径的.egg-infodir 并重新生成它之后,我能够拥有include_package_data=True
      猜你喜欢
      • 1970-01-01
      • 2015-10-18
      • 1970-01-01
      • 2012-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-03
      相关资源
      最近更新 更多