Support for Python >3.10
Summary of the problem
Running Manticore on Python 3.10.4 runs into the following error,
Traceback (most recent call last):
File "/home/codespace/.python/current/bin/manticore", line 5, in <module>
from manticore.__main__ import main
File "/opt/python/latest/lib/python3.10/site-packages/manticore/__main__.py", line 13, in <module>
from .wasm.cli import wasm_main
File "/opt/python/latest/lib/python3.10/site-packages/manticore/wasm/__init__.py", line 1, in <module>
from .manticore import ManticoreWASM
File "/opt/python/latest/lib/python3.10/site-packages/manticore/wasm/manticore.py", line 9, in <module>
from .types import I32, I64, F32, F64
File "/opt/python/latest/lib/python3.10/site-packages/manticore/wasm/types.py", line 5, in <module>
import wasm
File "/opt/python/latest/lib/python3.10/site-packages/wasm/__init__.py", line 5, in <module>
from .decode import (
File "/opt/python/latest/lib/python3.10/site-packages/wasm/decode.py", line 5, in <module>
from .modtypes import ModuleHeader, Section, SEC_UNK, SEC_NAME, NameSubSection
File "/opt/python/latest/lib/python3.10/site-packages/wasm/modtypes.py", line 4, in <module>
from .wasmtypes import *
File "/opt/python/latest/lib/python3.10/site-packages/wasm/wasmtypes.py", line 4, in <module>
from .types import UIntNField, UnsignedLeb128Field, SignedLeb128Field
File "/opt/python/latest/lib/python3.10/site-packages/wasm/types.py", line 296, in <module>
class Structure(WasmField):
File "/opt/python/latest/lib/python3.10/site-packages/wasm/compat.py", line 26, in wrapper
return metaclass(cls.__name__, cls.__bases__, orig_vars)
File "/opt/python/latest/lib/python3.10/site-packages/wasm/types.py", line 264, in __new__
isinstance(cur_field, collections.Callable) or
AttributeError: module 'collections' has no attribute 'Callable'
Error seems reasonable as Callable was removed from the collections module and moved to collections.abc.Callable in 3.10 https://docs.python.org/3/whatsnew/3.10.html#collections-abc
Manticore version
Version: 0.3.7
Python version
Python 3.10.4
OS / Environment
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04 Codename: focal
Step to reproduce the behavior
Expected behavior
Manticore runs.
Actual behavior
Manticore fails with error.
Thank you for the report and details. Unfortunately, it looks like that dependency is no longer maintained https://github.com/athre0z/wasm
We'll need to find a new dependency for web assembly to fix this issue.
@ekilmer @anudit Hi do you guys have any way that could solve this issue? Do I need to install older version of python to install manticore and run sol file? Since I tried with version 2.7 and getting same errors.
@bhoomishah20 Please use any Python version 3.7, 3.8, or 3.9. We test Manticore in CI with Python 3.7.
@ekilmer I am also getting same error, infact I am using Python version 3.9 still getting below error. Any idea how to resolve this and execute the manticore using sol file?
(base)MacBook-Air-2 contracts % manticore imp.sol
2022-10-10 23:41:59,710: [94266] m.c.manticore:WARNING: Manticore is only supported on Linux. Proceed at your own risk!
2022-10-10 23:42:00,239: [94266] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'>
2022-10-10 23:42:00,239: [94266] m.main:INFO: Beginning analysis
2022-10-10 23:42:00,243: [94266] m.e.manticore:INFO: Starting symbolic create contract
2022-10-10 23:42:00,561: [94266] m.e.manticore:INFO: Starting symbolic transaction: 0
2022-10-10 23:42:00,608: [94266] m.e.manticore:INFO: 0 alive states, 2 terminated states
Traceback (most recent call last):
File "/Users/opt/anaconda3/bin/manticore", line 8, in
@Rajatrs96 Your error is different. I mention in https://github.com/trailofbits/manticore/issues/2496#issuecomment-1263567766 that this error does not appear when running with Python 3.7.
There is a work around here: https://stackoverflow.com/questions/69515086/error-attributeerror-collections-has-no-attribute-callable-using-beautifu (just line number should be 264)
#Change lib/python3.10/site-packages/wasm/types.py:264 isinstance(cur_field, collections.Callable) to isinstance(cur_field, collections.abc.Callable)
Still having the same issue
There is a work around here: https://stackoverflow.com/questions/69515086/error-attributeerror-collections-has-no-attribute-callable-using-beautifu (just line number should be 264)
#Change lib/python3.10/site-packages/wasm/types.py:264 isinstance(cur_field, collections.Callable) to isinstance(cur_field, collections.abc.Callable)
Still having the same issue.