nickovic / rtamt

Specification-based real-time monitoring library
BSD 3-Clause "New" or "Revised" License
50 stars 20 forks source link

Running RTAMT fails due to incorrect antlr version #166

Closed Leviathan321 closed 1 year ago

Leviathan321 commented 1 year ago

Hello,

I am using python-3.9 on linux. When I download rtamt via pip install rtamt the following error occurs:


Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/sorokin/Projects/FOCETA/evaluation/rtamt_test.py", line 1, in <module>
    import rtamt 
  File "/home/sorokin/Projects/FOCETA/venv_39/lib/python3.9/site-packages/rtamt/__init__.py", line 15, in <module>
    from rtamt.spec.stl.discrete_time.specification import STLDiscreteTimeSpecification
  File "/home/sorokin/Projects/FOCETA/venv_39/lib/python3.9/site-packages/rtamt/spec/stl/discrete_time/specification.py", line 5, in <module>
    from rtamt.spec.ltl.discrete_time.specification import LTLDiscreteTimeSpecification
  File "/home/sorokin/Projects/FOCETA/venv_39/lib/python3.9/site-packages/rtamt/spec/ltl/discrete_time/specification.py", line 9, in <module>
    from rtamt.parser.ltl.LtlLexer import LtlLexer
  File "/home/sorokin/Projects/FOCETA/venv_39/lib/python3.9/site-packages/rtamt/parser/ltl/LtlLexer.py", line 342, in <module>
    class LtlLexer(Lexer):
  File "/home/sorokin/Projects/FOCETA/venv_39/lib/python3.9/site-packages/rtamt/parser/ltl/LtlLexer.py", line 344, in LtlLexer
    atn = ATNDeserializer().deserialize(serializedATN())
  File "/home/sorokin/Projects/FOCETA/venv_39/lib/python3.9/site-packages/antlr4/atn/ATNDeserializer.py", line 28, in deserialize
    self.checkVersion()
  File "/home/sorokin/Projects/FOCETA/venv_39/lib/python3.9/site-packages/antlr4/atn/ATNDeserializer.py", line 50, in checkVersion
    raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").")
Exception: Could not deserialize ATN with version  (expected 4).

I have checked the antlr version referenced in the files in the downloaded rtamt package, the version 4.5.1 is mentioned. But automatically version 4.12.0 gets installed. When I uninstall v 4.12.0 and install, e.g., v 4.5.2.1, the error is gone.

Also there is a mismatch between the parser version on the github and the one in the pypi package.

Lev

nickovic commented 1 year ago

The pypi package is now in sync with the master branch.

The library is now setup to install the 4.7 version of ANTLR4, the same version with which the grammar files were compiled.