web3.py: No module named web3.__main__; 'web3' is a package and cannot be directly executed`

  • Version: 4.0.0
  • Python: 3.6
  • OS: linux Ubuntu 16.04 Im run python3 -m web3 error

/usr/local/bin/python3: No module named web3.__main__; 'web3' is a package and cannot be directly executed

and

python3 /var/www/ico.1ct.io/public_html/wp-content/themes/1ct/py/token.py Traceback (most recent call last):

File "/var/www/ico.1ct.io/public_html/wp-content/themes/1ct/py/token.py", line 7, in <module>
   from web3.providers.eth_tester import EthereumTesterProvider
 File "/usr/local/lib/python3.6/site-packages/web3/__init__.py", line 1, in <module>
   import pkg_resources
 File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 26, in <module>
   import zipfile
 File "/usr/local/lib/python3.6/zipfile.py", line 13, in <module>
   import shutil
 File "/usr/local/lib/python3.6/shutil.py", line 22, in <module>
   import bz2
 File "/usr/local/lib/python3.6/bz2.py", line 19, in <module>
   from threading import RLock
 File "/usr/local/lib/python3.6/threading.py", line 7, in <module>
   from traceback import format_exc as _format_exc
 File "/usr/local/lib/python3.6/traceback.py", line 5, in <module>
   import linecache
 File "/usr/local/lib/python3.6/linecache.py", line 11, in <module>
   import tokenize
 File "/usr/local/lib/python3.6/tokenize.py", line 35, in <module>
   from token import *
 File "/var/www/ico.1ct.io/public_html/wp-content/themes/1ct/py/token.py", line 7, in <module>
   from web3.providers.eth_tester import EthereumTesterProvider
 File "/usr/local/lib/python3.6/site-packages/web3/providers/__init__.py", line 1, in <module>
   from .base import (  # noqa: F401
 File "/usr/local/lib/python3.6/site-packages/web3/providers/base.py", line 4, in <module>
   from eth_utils import (
 File "/usr/local/lib/python3.6/site-packages/eth_utils/__init__.py", line 97, in <module>
   __version__ = pkg_resources.get_distribution("eth-utils").version
AttributeError: module 'pkg_resources' has no attribute 'get_distribution'

I can not do 10 days. Once it happened, but after a few hours it stopped working. help me please

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (8 by maintainers)

Most upvoted comments

Now you seem to be on a older version of eth-utils. pip install --upgrade eth-utils should give you some progress. I think you’re having this problem because you installed an older version of web3.py previously. Can you create a new virtualenv and install web3 in it? try to use --no-cache-dir option to make sure its doesn’t install from cache. pip install --no-cache-dir --upgrade web3