0

There is an issue when using tox to run pytest for my package using py26 as one of the envs (global env is py3.6, py26 env is py2.6.9 installed via pyenv)

tox.ini file:

[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

The following error occurs during pandas installation:

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)

Any idea what's causing this syntax error?

EDIT:

Updated best answer: using -cconstraints.txt to enforce downgraded version of wheel

Brian Pollack
  • 198
  • 3
  • 12

1 Answers1

2

wheel dropped support for Python 2.6.

To install wheel compatible with Python 2.6 install version 0.29:

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

In tox.ini:

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

Or try constraints file:

[testenv]
deps=
    …
    -cconstraints.txt
    …

constraints.txt:

wheel==0.29.0
phd
  • 82,685
  • 13
  • 120
  • 165
  • Thanks, that does look the source of the problem. However, even when requiring a downgraded version of wheel, the same error appears. Do you have a prescription that requires pip to use that wheel version for the subsequent packages? – Brian Pollack Oct 09 '17 at 16:22
  • Remove `/Users/brianpollack/Coding/scikit-hep/.tox/py26` directory and rerun `tox` with updated `tox.ini`. – phd Oct 09 '17 at 16:24
  • Yeah I removed that and reran, and also removed all the cached wheels of the various dependencies. I am still running into this error. I'm using tox v2.9.1 – Brian Pollack Oct 09 '17 at 17:31
  • `source /Users/brianpollack/Coding/scikit-hep/.tox/py26/bin/activate`; `pip uninstall wheel`; `pip install wheel==0.29.0` – phd Oct 09 '17 at 22:10
  • Excellent, this prescription works and the rest of the packages can then be installed manually as well. Unfortunately, running `tox -e py26` after explicitly installing wheel==0.29.0 reinstalls wheel==0.30.0. Is it possible to prevent tox from reinstalling wheel? If not, I will open a gh issue. – Brian Pollack Oct 10 '17 at 17:51
  • Try constraints file. I extended the answer. – phd Oct 10 '17 at 19:47
  • I'm trying and the constraints file is ignored... help @phd? – alex Oct 27 '17 at 07:46