Hypothesis: Error caused by updating attrs in latest version?

Created on 3 Oct 2019  路  8Comments  路  Source: HypothesisWorks/hypothesis

While running the latest Hypothesis, I got the following traceback. I'm assuming it is related to the bumping of attrs version. Hypothesis Changelog

Traceback (most recent call last):
  File "/usr/local/miniconda3/envs/drugdiscovery/bin/pytest", line 11, in <module>
    sys.exit(main())
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/config/__init__.py", line 55, in main
    config = _prepareconfig(args, plugins)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/config/__init__.py", line 200, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/helpconfig.py", line 89, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/config/__init__.py", line 661, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/config/__init__.py", line 869, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/config/__init__.py", line 815, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/pluggy/manager.py", line 292, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 90, in load
    module = import_module(match.group('module'))
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 149, in exec_module
    exec(co, module.__dict__)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/hypothesis/__init__.py", line 36, in <module>
    from hypothesis.core import example, find, given, reproduce_failure, seed
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 149, in exec_module
    exec(co, module.__dict__)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/hypothesis/core.py", line 74, in <module>
    from hypothesis.internal.conjecture.engine import ConjectureRunner, ExitReason, sort_key
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 149, in exec_module
    exec(co, module.__dict__)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py", line 50, in <module>
    from hypothesis.internal.conjecture.shrinker import Shrinker, sort_key
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 149, in exec_module
    exec(co, module.__dict__)
  File "/usr/local/miniconda3/envs/drugdiscovery/lib/python3.6/site-packages/hypothesis/internal/conjecture/shrinker.py", line 1445, in <module>
    @attr.s(slots=True, eq=False)
TypeError: attrs() got an unexpected keyword argument 'eq'

I'm running

python= 3.6
pytest>=3.8.1 (latest)
question

Most helpful comment

Huh. Yep, I've reproduced this and reported it upstream... I'm going to close this issue because there's not much Hypothesis can do about a pip bug, but thanks very much for reporting this and your quick feedback!

As a workaround until the upstream bug is fixed, I suggest invoking pip install --upgrade ... to make it recheck dependencies, or use the pip-tools project to compile a list of your full transitive dependencies. Hope that helps!

All 8 comments

What version of attrs are you using?

I suspect the problem is that you managed to install the latest version of Hypothesis without respecting the new minimum version of attrs.

There is a problem with pip maybe because with requirements-tests.txt like

pytest>=3.8.1
pytest-cov>=2.6.0
hypothesis>=3.73.1

I've got on Travis CI

> python -m pip install -r requirements-tests.txt
...
ERROR: hypothesis 4.38.2 has requirement attrs>=19.2.0, but you'll have attrs 18.2.0 which is incompatible.

so it installs attrs of version 18.2, fixed this by anchoring

hypothesis==4.38.0

which is annoying and seems like a problem in dependency resolver

Also

> python -m pip install --ignore-installed -r requirements-tests.txt

with "floating" version seems to work in my case

and --force-reinstall seems to work too.

python -m pip --version?

> python -m pip install --upgrade pip setuptools
...
Successfully installed pip-19.2.3 setuptools-41.2.0

Huh. Yep, I've reproduced this and reported it upstream... I'm going to close this issue because there's not much Hypothesis can do about a pip bug, but thanks very much for reporting this and your quick feedback!

As a workaround until the upstream bug is fixed, I suggest invoking pip install --upgrade ... to make it recheck dependencies, or use the pip-tools project to compile a list of your full transitive dependencies. Hope that helps!

Ran in to the same, fixed with the workarounds above - do you have a link to the upstream issue @Zac-HD , thanks for reporting!

https://github.com/pypa/pip/issues/988 is the main issue - it's been open since 2013, but the Packaging working group got some grant funding late last year, and the timeline suggests that the resolver will be rolled out midyear and stable by the end of the year. Very exciting stuff!

Was this page helpful?
0 / 5 - 0 ratings