ethereum / trinity

The Trinity client for the Ethereum network
https://trinity.ethereum.org
MIT License
472 stars 145 forks source link

ModuleNotFoundError: No module named 'eth_utils' #713

Closed glaksmono closed 3 years ago

glaksmono commented 5 years ago

I started from fresh, did pip install -e .[dev], tried to run pytest, and I'm getting this error:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_pytest/config.py", line 342, in _getconftestmodules
    return self._path2confmods[path]
KeyError: local('/Users/glaksmono/Documents/trinity/tests')

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_pytest/config.py", line 373, in _importconftest
    return self._conftestpath2mod[conftestpath]
KeyError: local('/Users/glaksmono/Documents/trinity/tests/conftest.py')

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_pytest/config.py", line 379, in _importconftest
    mod = conftestpath.pyimport()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/py/_path/local.py", line 668, in pyimport
    __import__(modname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 212, in load_module
    py.builtin.exec_(co, mod.__dict__)
  File "/Users/glaksmono/Documents/trinity/tests/conftest.py", line 9, in <module>
    from eth_utils import (
ModuleNotFoundError: No module named 'eth_utils'
ERROR: could not load /Users/glaksmono/Documents/trinity/tests/conftest.py

Here's the pip freeze output:

alabaster==0.7.12
apipkg==1.5
appnope==0.1.0
argh==0.26.2
asn1crypto==0.24.0
async-generator==1.10
async-lru==0.1.0
asyncio-cancel-token==0.1.0a2
atomicwrites==1.3.0
attrdict==2.0.1
attrs==19.1.0
Babel==2.7.0
backcall==0.1.0
base58==1.0.3
bleach==3.1.0
bloom-filter==1.3
bumpversion==0.5.3
cached-property==1.5.1
cachetools==3.1.1
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
coincurve==10.0.0
colorama==0.4.1
coverage==4.5.3
cryptography==2.6.1
cytoolz==0.9.0.1
decorator==4.4.0
docopt==0.6.2
docutils==0.14
eth-abi==1.3.0
eth-account==0.2.3
eth-bloom==1.0.3
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.3.0
eth-rlp==0.1.2
eth-typing==2.1.0
eth-utils==1.6.0
execnet==1.6.0
factory-boy==2.11.1
Faker==1.0.7
flake8==3.5.0
flake8-bugbear==18.8.0
hexbytes==0.2.0
hypothesis==3.69.5
idna==2.7
ifaddr==0.1.6
imagesize==1.1.0
ipython==6.5.0
ipython-genutils==0.2.0
jedi==0.13.3
Jinja2==2.10.1
jsonschema==3.0.1
lahja==0.12.0
lru-dict==1.1.6
lxml==4.3.4
MarkupSafe==1.1.1
mccabe==0.6.1
more-itertools==7.0.0
multiaddr==0.0.8
mypy==0.701
mypy-extensions==0.4.1
netaddr==0.7.19
netdisco==2.6.0
netifaces==0.10.9
packaging==19.0
parsimonious==0.8.1
parso==0.4.0
pathtools==0.1.2
pexpect==4.7.0
pickleshare==0.7.5
pkginfo==1.5.0.1
pluggy==0.7.1
plyvel==1.0.5
prompt-toolkit==1.0.16
protobuf==3.8.0
ptyprocess==0.6.0
py==1.8.0
py-ecc==1.6.0
py-evm==0.2.0a43
pycodestyle==2.3.1
pycparser==2.19
pycryptodome==3.8.2
pyethash==0.1.27
pyflakes==1.6.0
Pygments==2.4.2
pymultihash==0.8.2
pyparsing==2.4.0
pyrsistent==0.15.2
pysha3==1.0.2
pytest==3.6.4
pytest-asyncio==0.9.0
pytest-asyncio-network-simulator==0.1.0a2
pytest-cov==2.5.1
pytest-mock==1.10.4
pytest-watch==4.2.0
pytest-xdist==1.18.1
python-dateutil==2.8.0
python-snappy==0.5.4
pytz==2019.1
PyYAML==5.1.1
readme-renderer==24.0
requests==2.22.0
requests-toolbelt==0.9.1
rlp==1.1.0
ruamel.yaml==0.15.97
simplegeneric==0.8.1
six==1.12.0
snowballstemmer==1.2.1
Sphinx==1.7.9
sphinx-rtd-theme==0.4.3
sphinxcontrib-asyncio==0.2.0
sphinxcontrib-websupport==1.1.2
SQLAlchemy==1.3.4
sqlalchemy-stubs==0.1
ssz==0.1.0a8
termcolor==1.1.0
text-unidecode==1.2
toolz==0.9.0
tox==2.7.0
tqdm==4.32.1
traitlets==4.3.2
trie==1.4.0
-e git+git@github.com:glaksmono/trinity.git@f90def71f0dadbc6874069401afc2b1e938a82fc#egg=trinity
twine==1.13.0
typed-ast==1.3.5
typing-extensions==3.7.2
uPnPClient==0.0.8
urllib3==1.25.3
uvloop==0.11.2
varint==1.0.2
virtualenv==16.6.0
watchdog==0.9.0
wcwidth==0.1.7
web3==4.4.1
webencodings==0.5.1
websockets==5.0.1
zeroconf==0.23.0
carver commented 5 years ago

Other than pytest, eth_utils is the very first library to get loaded when running tests. Are you 100% sure that you are running pytest in the environment that has you ran pip freeze from?

glaksmono commented 5 years ago

@carver yes, I did it sequentially all within the venv

voith commented 5 years ago

@glaksmono sometimes I get this error when pytest is not picked up from virtualenv but rather from a global installation. Something like this happens:

(vyper) ➜  vyper git:(master) ✗ which pytest
/usr/local/bin/pytest

deactivating and activating virtualenv usually helps in such a case.

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_pytest/config.py

If you look at this path carefully, then it doesn't look like a virtualenv to me

PS: I'm not 100% sure that this is the problem in your case, but worth giving it a try.