pythonpipblockchaintrontronweb

importing tronweb shows import error: cannot import name 'hashable' from 'collections'


After installing tronweb using 'pip install tronweb', when I try to import but it shows an import error which is cannot import name 'hashable' from 'collections'


Solution

  • Search by error message for the import instruction and you should edit:

    from collections import Hashable
    

    to:

    from collections.abc import Hashable
    

    It was moved from collections to collections.abc since Python 3.3. It supported the old location till Python 3.9. But in python 3.10 it was removed.