Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not deserialize ATN with version (expected 4) while using python age driver

Tags:

apache-age

I am trying to use python drive for age. For this, I directly imported from the age file in the driver code using from age import *. But when I ran the code, I encountered the following error:

File "/home/abhishek/.local/lib/python3.10/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).

The is there as it is in error.

I tried using the debugger and the error is coming from the file AgtypeLexer.py on the line:

atn = ATNDeserializer().deserialize(serializedATN())

What can be the possible reason for this, and how can this be fixed?

Edit:antlr4-python3-runtime version 4.11.1 is installed properly on the system.

like image 718
abhishek2046 Avatar asked Jun 28 '26 08:06

abhishek2046


1 Answers

This error is mainly caused due to the version of antlr4 installed. The code below should solve this:

# When using the apache-age-python package
pip install antlr4-python3-runtime==4.9.2  

    # When importing age from the cloned repository 
pip install antlr4-python3-runtime==4.11.1

Check this thread as they already provided solutions for this error.

like image 125
Tito Avatar answered Jul 02 '26 11:07

Tito



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!