pytest: more-itertools 6.0.0 release breaks pytest 4.2

We are seeing issues with new installations of pytest-4.2, as it pulls in more-itertools-6.0.0 (which was released about 2 hours ago at the time of writing this issue).

Is there any way we can lock in pytest-4.2 to use more-itertools-5.0.0 to maintain the python 2.7 compatability?

Here are the errors we are seeing with pytest-4.2 and more-itertools-6.0.0:

12-Feb-2019 02:48:58 | File "/usr/local/lib/python2.7/dist-packages/more_itertools/more.py", line 329
-- | --
12-Feb-2019 02:48:58 | def _collate(*iterables, key=lambda a: a, reverse=False):
12-Feb-2019 02:48:58 | ^
12-Feb-2019 02:48:58 | SyntaxError: invalid syntax

And here is a link to more-itertools release history, indicating that python 2.7 is not supported with more-itertools-6.0.0: https://pypi.org/project/more-itertools/6.0.0/

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 31 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Please update your pip! more-itertools==6.0.0 does set the requires_python metadata, so up-to-date versions of pip will not attempt to install it on old versions of Python.

More generally, this isn’t actually a pytest issue, and our only “fix” would be to prevent the upgrade for Python 3 users. Remember, Python 2 is end-of-life at the end of 2019, and Pytest will drop support at that time.

I’m leaving this open for now so others find the issue, but the only solution is pip install --upgrade pip.

I locked more-itertools==5.0.0 in my project’s requirements.txt 😃 We are using pip 8.x, facing the same issue

I get the same error as @tayalakansh: pip detects the python version mismatch and then fails, instead of installing the last compatible version. So it’s a cleaner error than OP, but the result (you can’t use pytest with python2 currently) is the same:

$ virtualenv testenv
New python executable in /tmp/testenv/bin/python
Installing setuptools, pip, wheel...done.
$ . testenv/bin/activate
(testenv) $ python --version
Python 2.7.12
(testenv) $ pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already up-to-date: pip in ./testenv/lib/python2.7/site-packages (19.0.2)
(testenv) $ pip install pytest    
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pytest
Collecting atomicwrites>=1.0 (from pytest)
Collecting py>=1.5.0 (from pytest)
Collecting pluggy>=0.7 (from pytest)
Requirement already satisfied: setuptools in ./testenv/lib/python2.7/site-packages (from pytest) (40.8.0)
Collecting six>=1.10.0 (from pytest)
Collecting pathlib2>=2.2.0; python_version < "3.6" (from pytest)
Collecting more-itertools>=4.0.0 (from pytest)
more-itertools requires Python '>=3.4' but the running Python is 2.7.12
(testenv) [1]$ 

Fixed, a workaround was implemented in #4774 and will be released in 4.2.1. 👍

Might I ask why pytest doesn’t pin specific versions of requirements? Having installations randomly picking up new versions of dependencies makes for some annoying issues.

If you are running your own devpi-server you need to upgrade to 4.7 or newer to support ‘requires_python’ Then it will give you the 5.0.0 package without having to ask for it specifically. Or you can switch to go directly to pypi, then it should also work

https://pypi.org/project/devpi-server/