Web3.py: Web3.py v4.0.0b9: Python 3.6.4 fresh install error

Created on 21 Feb 2018  路  10Comments  路  Source: ethereum/web3.py

Setup

  • Version: 4.0.0b9
  • Python: 3.6.4
  • OS: linux
  • stacktrace:
$ pip install web3>=4.0.0b9
...
$ python -m web3
Traceback (most recent call last):
  File "/home/bryant/.pyenv/versions/3.6.4/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/bryant/.pyenv/versions/3.6.4/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/bryant/.pyenv/versions/3.6.4/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/web3/__init__.py", line 8, in <module>
    from web3.main import Web3  # noqa: E402
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/web3/main.py", line 16, in <module>
    from web3.eth import Eth
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/web3/eth.py", line 16, in <module>
    from web3.contract import (
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/web3/contract.py", line 7, in <module>
    from eth_abi import (
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/eth_abi/__init__.py", line 3, in <module>
    from eth_abi.abi import (  # NOQA
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/eth_abi/abi.py", line 19, in <module>
    from eth_abi.encoding import (
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/eth_abi/encoding.py", line 27, in <module>
    from eth_abi.utils.padding import (
  File "/home/bryant/.pyenv/versions/test/lib/python3.6/site-packages/eth_abi/utils/padding.py", line 3, in <module>
    from eth_utils import (
ImportError: cannot import name 'pad_left'

What was wrong?

Installed the beta from scratch, looks like eth-utils 1.0.0b1 no longer implements pad_left, pad_right?

How can it be fixed?

Not sure, something is off with eth-abi, eth-utils

Most helpful comment

Confirmed Beta 10 fixes

All 10 comments

Looks like this captures the problem: https://github.com/ethereum/eth-abi/pull/28

It's the eth-utils beta 2 that dropped pad_*. So as a temporary workaround, you can force eth-utils to beta 1. We'll get all the eth-* libraries that use pad_* cleaned up soon (certainly by tomorrow).

Confirmed this solves the problem:

$ pip install eth-utils>=1.0.0b1,<1.0.0b2 # Temporary work-around
$ pip install web3>=4.0.0b9
$ python -m web3
# No ImportError now!

Doesn't work for me, I have python3 and pip3 though

My pip and python are pip3 and python3. I use pyenv to manage python virtualenvs

Beta 10 was just released. It works for me in a fresh venv, with no caching. Closing as fixed, but please comment/reopen if you are still experiencing issues.

Confirmed Beta 10 fixes

Can anyone help me out here? Just tried to install this with pipenv with pipenv install web3 but getting the pad_left error

Nevermind.. reinstalled it and now working.

Same here, was getting ImportError: cannot import name 'decode_abi' and ImportError: cannot import name 'collapse_type' so I uninstalled eth abi and web3

python3.6 -m pip uninstall web3
python3.6 -m pip uninstall eth-abi



md5-a1ae416f5a3ee0f3d4f1df181a4f3ca1



python3.6 -m pip install eth-abi --user



md5-2f7279d0f770aae45de2a800d877afdf



python3.6 -m pip install web3 --user

in that order.

Was this page helpful?
0 / 5 - 0 ratings