【问题标题】:Installing pandas with tox for py26使用 tox for py26 安装 pandas
【发布时间】:2018-03-18 18:20:41
【问题描述】:

使用tox 为我的包运行pytest 时出现问题,使用py26 作为环境之一(全局环境是py3.6,py26 环境是通过pyenv 安装的py2.6.9)

tox.ini 文件:

[tox]
envlist = py26,py27,py36
[testenv]
deps=
   pytest
   PyPDT
   py26: numpy<1.12.0
   py{27,36}: numpy
   py26: pandas==0.16.2
   py{27,36}: pandas
   py26: matplotlib<1.5.0
   py{27,36}: matplotlib<2.1.0

commands=pytest

pandas安装时出现如下错误:

Collecting pandas==0.16.2
  Using cached pandas-0.16.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/pr/ghw8lmr94c5g9ntx4cp9990w0000gn/T/pip-build-cuCAyE/pandas/setup.py", line 406, in <module>
        from wheel.bdist_wheel import bdist_wheel
      File "/Users/brianpollack/Coding/scikit-hep/.tox/py26/lib/python2.6/site-packages/wheel/bdist_wheel.py", line 407
        ignore=lambda x, y: {'PKG-INFO', 'requires.txt', 'SOURCES.txt',
                                       ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/pr/ghw8lmr94c5g9ntx4cp9990w0000gn/T/pip-build-cuCAyE/pandas/

ERROR: could not install deps [setuptools, pytest, PyPDT, numpy<1.12.0, pandas==0.16.2, matplotlib<1.5.0]; v = InvocationError('/Users/brianpollack/Coding/scikit-hep/.tox/py26/bin/pip install setuptools pytest PyPDT numpy<1.12.0 pandas==0.16.2 matplotlib<1.5.0 (see /Users/brianpollack/Coding/scikit-hep/.tox/py26/log/py26-1.log)', 1)

知道是什么导致了这个语法错误吗?

编辑:

更新的最佳答案:使用-cconstraints.txt 强制执行降级版本的wheel

【问题讨论】:

    标签: python pandas python-3.6 python-2.6 tox


    【解决方案1】:

    wheeldropped support for Python 2.6.

    安装wheel兼容Python 2.6安装版本0.29

    source /Users/brianpollack/Coding/scikit-hep/.tox/py26/bin/activate‌​
    pip uninstall wheel
    pip install wheel==0.29.0
    

    在 tox.ini 中:

    [testenv]
    deps=
        …
        py26: wheel==0.29.0
        …
    

    或者试试constraints file:

    [testenv]
    deps=
        …
        -cconstraints.txt
        …
    

    约束.txt:

    wheel==0.29.0
    

    【讨论】:

    • 谢谢,这看起来确实是问题的根源。但是,即使需要降级版本的 wheel,也会出现相同的错误。您是否有需要 pip 为后续包使用该轮版本的处方?
    • 删除/Users/brianpollack/Coding/scikit-hep/.tox/py26 目录并使用更新的tox.ini 重新运行tox
    • 是的,我删除了它并重新运行,还删除了各种依赖项的所有缓存轮子。我仍然遇到这个错误。我正在使用 tox v2.9.1
    • source /Users/brianpollack/Coding/scikit-hep/.tox/py26/bin/activate; pip uninstall wheel; pip install wheel==0.29.0
    • 太好了,这个处方有效,其余的软件包也可以手动安装。不幸的是,在显式安装wheel==0.29.0 后运行tox -e py26 会重新安装wheel==0.30.0。是否可以防止tox重新安装车轮?如果没有,我会打开一个 gh issue。
    猜你喜欢
    • 2016-10-11
    • 2023-01-18
    • 1970-01-01
    • 2023-04-06
    • 2012-10-26
    • 1970-01-01
    • 1970-01-01
    • 2013-05-04
    • 1970-01-01
    相关资源
    最近更新 更多