Skip to content

Error importing Uniswap with the latest version of web3.py #322

@arjunaskykok

Description

@arjunaskykok

Describe the bug

>>> from uniswap import Uniswap
from web3.contract import Contract, ContractFunction
ImportError: cannot import name 'ContractFunction' from 'web3.contract'

To Reproduce

$ python3.11 -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install git+https://github.com/ethereum/web3.py.git
(.venv) $ pip install uniswap-python
(.venv) $ python
Python 3.11.2 (main, Feb  8 2023, 14:49:24) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from uniswap import Uniswap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/arjuna/.../review_uniswap_python/.venv/lib/python3.11/site-packages/uniswap/__init__.py", line 2, in <module>
    from .uniswap import Uniswap, _str_to_addr
  File "/home/arjuna/.../review_uniswap_python/.venv/lib/python3.11/site-packages/uniswap/uniswap.py", line 11, in <module>
    from web3.contract import Contract, ContractFunction
ImportError: cannot import name 'ContractFunction' from 'web3.contract' (/home/arjuna/.../review_uniswap_python/.venv/lib/python3.11/site-packages/web3/contract/__init__.py)
>>> from web3.contract import ContractFunction
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'ContractFunction' from 'web3.contract' (/home/arjuna/.../review_uniswap_python/.venv/lib/python3.11/site-packages/web3/contract/__init__.py)
>>> from web3.contract.contract import ContractFunction
>>>

Expected behavior
We should be able to import Uniswap with the latest version of web3.

Additional context
The reason I installed web3.py from GitHub repo is Python3.11 doesn't work with web3.py from pip.

ImportError: cannot import name 'getargspec' from 'inspect' (/usr/lib/python3.11/inspect.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy