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

Could not deserialize ATN with version (expected 4). #3997

Open
moxi828 opened this issue Dec 3, 2022 · 12 comments
Open

Could not deserialize ATN with version (expected 4). #3997

moxi828 opened this issue Dec 3, 2022 · 12 comments

Comments

@moxi828
Copy link

moxi828 commented Dec 3, 2022

OS:ubuntu 22.04
python:3.10.6
java:1.8
ATN:4.8

python runtime error:
raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").")
Exception: Could not deserialize ATN with version (expected 4).

How to solve this problem? thank you

@ericvergnaud
Copy link
Contributor

ericvergnaud commented Dec 3, 2022 via email

@moxi828
Copy link
Author

moxi828 commented Dec 3, 2022

Hi,Have you tried regenerating your parser?Envoyé de mon iPhoneLe 3 déc. 2022 à 04:15, moxi828 @.> a écrit : OS:ubuntu 22.04 python:3.10.6 java:1.8 ATN:4.8 python runtime error: raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").") Exception: Could not deserialize ATN with version (expected 4). How to solve this problem? thank you —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.>

Sorry, I'm a novice, and I don't know much about this. I'm preparing to learn related knowledge. The above error occurred when I was preparing to run a tool named PiRL. So what should I do to regenerate the parser? Thank you very much for your patience.

@ericvergnaud
Copy link
Contributor

I know nothing about PiRL, so can't really help.
Please read the online docs to find out how to regenerate your parser.

@moxi828
Copy link
Author

moxi828 commented Dec 3, 2022

I know nothing about PiRL, so can't really help. Please read the online docs to find out how to regenerate your parser.

thank you very much

@zhangwenmeng111
Copy link

I know nothing about PiRL, so can't really help. Please read the online docs to find out how to regenerate your parser.

Which file explains how to regenerate my parser?please?
I have the same problem when using antlr4, which can not be solved so far. Thank you for your answer.

@zhangwenmeng111
Copy link

I know nothing about PiRL, so can't really help. Please read the online docs to find out how to regenerate your parser.

How should I regenerate my parser? Which online docs shoud l read? Thank you very much!

@jcmuel
Copy link

jcmuel commented Dec 23, 2022

Hi,

I had the same issue with exactly the same error message when I tried to run the 04-Calc example from py3antlr4book.

The GIT repo of py3antlr4book shipped an old version of ANTLR (antlr-4.7.2-complete.jar), which is incompatible with the latest antlr4-python3-runtime that I installed via PyPI (4.11.1).

In my case, I upgraded the version of ANTLR for generating the parser and created a PR to fix the issue in the book: jszheng/py3antlr4book#15.
Using the antlr4 executable that ships with antlr4-python3-runtime instead of the JAR from py3antlr4book also solves the problem.

In your case, you probably either have to regenerate the parser of the PiRL tool using the latest ANTLR or downgrade to an older version of the Python 3 package antlr4-python3-runtime if you don't want to make changes in PiRL.

@eugenos-programos
Copy link

eugenos-programos commented Mar 21, 2023

Try to reinstall antlr4 runtime with appropriate version:
pip uninstall antlr4-python3-runtime
pip install antlr4-python3-runtime==<ANTLR version>
To check your ANTLR version run antlr4 command.

@iliyami
Copy link

iliyami commented Apr 10, 2023

I downgraded my antlr4-python3-runtime to 4.9.3 and the error fixed.

@himito
Copy link

himito commented Sep 25, 2023

Try to reinstall antlr4 runtime with appropriate version: pip uninstall antlr4-python3-runtime pip install antlr4-python3-runtime==<ANTLR version> To check your ANTLR version run antlr4 command.

I installed with pip install antlr4-python3-runtime==$(antlr4 | grep Version | awk '{print $5;}')

@xnerhu
Copy link

xnerhu commented Jan 11, 2024

python

@AI-General
Copy link

Thank you @iliyami

It works

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

No branches or pull requests

9 participants