Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Python >3.10 #2577

Open
anudit opened this issue Jul 31, 2022 · 7 comments
Open

Support for Python >3.10 #2577

anudit opened this issue Jul 31, 2022 · 7 comments
Assignees
Labels

Comments

@anudit
Copy link

anudit commented Jul 31, 2022

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.

@anudit anudit added the bug label Jul 31, 2022
@ekilmer
Copy link
Contributor

ekilmer commented Aug 1, 2022

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.

@elopez elopez mentioned this issue Sep 23, 2022
@bhoomishah20
Copy link

@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.

@ekilmer
Copy link
Contributor

ekilmer commented Sep 26, 2022

@bhoomishah20 Please use any Python version 3.7, 3.8, or 3.9. We test Manticore in CI with Python 3.7.

@Rajatrs96
Copy link

Rajatrs96 commented Oct 11, 2022

@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
sys.exit(main())
File "/Users/opt/anaconda3/lib/python3.9/site-packages/manticore/main.py", line 42, in main
ethereum_main(args, logger)
File "/Users/opt/anaconda3/lib/python3.9/site-packages/manticore/ethereum/cli.py", line 145, in ethereum_main
m.finalize(only_alive_states=args.only_alive_testcases)
File "/Users/opt/anaconda3/lib/python3.9/site-packages/manticore/core/manticore.py", line 177, in newFunction
return func(self, *args, **kw)
File "/Users/opt/anaconda3/lib/python3.9/site-packages/manticore/ethereum/manticore.py", line 1778, in finalize
proc.start()
File "/Users/opt/anaconda3/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/Users/opt/anaconda3/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/Users/opt/anaconda3/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/Users/opt/anaconda3/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/Users/opt/anaconda3/lib/python3.9/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/Users/opt/anaconda3/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/Users/opt/anaconda3/lib/python3.9/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'ManticoreEVM.finalize..worker_finalize'

@ekilmer
Copy link
Contributor

ekilmer commented Oct 11, 2022

@Rajatrs96 Your error is different. I mention in #2496 (comment) that this error does not appear when running with Python 3.7.

@ekilmer ekilmer self-assigned this Nov 2, 2022
@ekilmer ekilmer added this to the Manticore 0.4.0 milestone Nov 30, 2022
@mbaraniak-doyensec
Copy link

mbaraniak-doyensec commented Jan 23, 2023

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)

@alfellati
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants