enzymefinance / oyente

An Analysis Tool for Smart Contracts
GNU General Public License v3.0
1.32k stars 309 forks source link

Update to Python 3 #411

Open Mikerah opened 3 years ago

Mikerah commented 3 years ago

I noticed while trying to install oyente that it only seems to work for Python 2 which has been deprecated for a few years. Would it be possible to update the code for oyente to work in a Python 3 environment?

yxliang01 commented 3 years ago

The master branch Oyente can run under Python 3 without issue. Although you can see Python 2 syntax, but they are translated when running under Python 3. Can you paste the exact installation steps and error message you saw? I recommend you to build a docker image that is the easiest way to get Oyente working.

eerkaijun commented 3 years ago

@yxliang01 I've also encountered this error. When I pip install oyente, there's this error code:

Collecting oyente
  Downloading oyente-0.2.7.tar.gz (35 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/kaijun/Documents/oyente-evaluation/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ze2h3ys5/oyente/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ze2h3ys5/oyente/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-60efm66y
         cwd: /tmp/pip-install-ze2h3ys5/oyente/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ze2h3ys5/oyente/setup.py", line 10, in <module>
        long_description=open('README.md').read(),
    FileNotFoundError: [Errno 2] No such file or directory: 'README.md'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
yxliang01 commented 3 years ago

The version on Pypi (installed by pip) is very outdated. You should install from this GitHub Repo and it has been working fine for me and my team members.

strawberrylady99 commented 3 years ago

I hava the same problem,how can I solve it

wuhongjun15 commented 3 years ago

I can't install web3 by using python2, but the other dependencies need python2 rather than python3. What should I do?

Troublor commented 3 years ago

@yxliang01 When installing from this Repo under python 3.7, the installation works fine, but running oyente shows the following error:

> oyente --help
Traceback (most recent call last):
  File "/home/troublor/workspace/oyente/python3.7/bin/oyente", line 5, in <module>
    from oyente.oyente import main
  File "/home/troublor/workspace/oyente/python3.7/lib/python3.7/site-packages/oyente/oyente.py", line 63
    print "======= error ======="
                                ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("======= error =======")?
mrx23dot commented 2 years ago

The bottleneck is z3 dependence on python2, use docker