ape icon indicating copy to clipboard operation
ape copied to clipboard

Better error messaging w/ Ape and Brownie in the same environment

Open parseb opened this issue 2 years ago • 6 comments

Environment information

  • OS: linux
  • Python Version: 3.8.10
  • ape and plugin versions:
$ ape --version
# 0.3.5

$ ape plugins list
  solidity    0.3.2
  foundry     0.2.0
  vyper       0.3.0
  infura      0.3.0
  alchemy     0.3.0

  • Contents of your ape-config.yaml (NOTE: do not post anything private like RPC urls or secrets!):
$ cat ape-config.yaml
# name: gasJar

What went wrong?

Installed and trying to explore. I get this error on ape test. The docs mention an ape-test module, not sure if that's separate... tried to install but that failed. Since this is a framework I assume that's already in though. Beside the point tho.

Anyway. Installed. ape test fails with below trace. I don't have the time to look into in atm. Feel free to close without response. Just wanted to dump this for potential future reference.

  • ape test
`parseb@:~/Desktop/github/gasJar$ ape test
Traceback (most recent call last):
  File "/home/parseb/.local/bin/ape", line 8, in <module>
    sys.exit(cli())
  File "/home/parseb/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/parseb/.local/lib/python3.8/site-packages/ape/_cli.py", line 40, in invoke
    return super().invoke(ctx)
  File "/home/parseb/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/parseb/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/parseb/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/ape_test/_cli.py", line 17, in cli
    return_code = pytest.main([*pytest_args], ["ape_test"])
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1172, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/manager.py", line 300, in load_setuptools_entrypoints
    self.register(plugin, name=ep.name)
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 436, in register
    ret: Optional[str] = super().register(plugin, name)
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/manager.py", line 127, in register
    hook._maybe_apply_history(hookimpl)
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 333, in _maybe_apply_history
    res = self._hookexec(self, [method], kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/parseb/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/parseb/.local/lib/python3.8/site-packages/brownie/test/plugin.py", line 50, in pytest_addoption
    parser.addoption(
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/argparsing.py", line 96, in addoption
    self._anonymous.addoption(*opts, **attrs)
  File "/home/parseb/.local/lib/python3.8/site-packages/_pytest/config/argparsing.py", line 355, in addoption
    raise ValueError("option names %s already added" % conflict)
ValueError: option names {'-I', '--interactive'} already added
`

How can it be fixed?

No clue.

parseb avatar Jul 27 '22 11:07 parseb

Can you post your pip freeze output?

fubuloubu avatar Jul 27 '22 13:07 fubuloubu

Sounds like you have Brownie installed in the same environment, which currently is not supported

antazoey avatar Jul 27 '22 14:07 antazoey

Do we want to leave this ticket open? Or close with the issue being identified as having Brownie and Ape installed in the same environment?

@unparalleled-js @fubuloubu

NotPeopling2day avatar Aug 08 '22 13:08 NotPeopling2day

@NotPeopling2day Can we try conditionally adding the pytest option? Like check if it already exists. If it does, use it. Else add it and then use it. This will help allow brownie and ape in the same environment (although I predict we will run into other issues at that point).

antazoey avatar Aug 08 '22 13:08 antazoey

Seems overly complicated, can we give a better error about brownie being installed in the same environment?

fubuloubu avatar Aug 08 '22 13:08 fubuloubu

Removing brownie 'solves' the issue. Having both in the same environment breaks both. Being aware, particularly given that most smart contract devs might not be python power users, is important.

Potentially other extra useful context, installing brownie in ape env. succeeds with:

ERROR: trie 2.0.0a5 has requirement typing-extensions<4,>=3.7.4, but you'll have typing-extensions 4.0.1 which is incompatible.
ERROR: pygithub 1.55 has requirement pyjwt>=2.0, but you'll have pyjwt 1.7.1 which is incompatible.
ERROR: py-multihash 0.2.3 has requirement base58<2.0,>=1.0.2, but you'll have base58 2.1.1 which is incompatible.
ERROR: py-cid 0.3.0 has requirement base58<2.0,>=1.0.2, but you'll have base58 2.1.1 which is incompatible.
ERROR: jupyter-client 7.3.0 has requirement python-dateutil>=2.8.2, but you'll have python-dateutil 2.8.1 which is incompatible.
ERROR: eth-ape 0.3.5 has requirement eth-account==0.5.7, but you'll have eth-account 0.5.9 which is incompatible.
ERROR: eth-ape 0.3.5 has requirement packaging<21.0,>=20.9, but you'll have packaging 21.3 which is incompatible.
ERROR: eth-ape 0.3.5 has requirement pluggy<1.0,>=0.13.1, but you'll have pluggy 1.0.0 which is incompatible.
ERROR: eth-ape 0.3.5 has requirement python-dateutil<3.0,>=2.8.2, but you'll have python-dateutil 2.8.1 which is incompatible.
ERROR: ape-solidity 0.3.2 has requirement packaging<21,>=20.9, but you'll have packaging 21.3 which is incompatible.
ERROR: ape-foundry 0.2.0 has requirement eth-ape<0.3.0,>=0.2.1, but you'll have eth-ape 0.3.5 which is incompatible.

parseb avatar Aug 08 '22 13:08 parseb

Note: brownie and ape's dependencies have diverged and there are other issues now before getting to this point.

antazoey avatar Sep 23 '22 15:09 antazoey