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

improve antlr import error message #4888

Merged
merged 1 commit into from
Feb 15, 2020

Conversation

masahi
Copy link
Member

@masahi masahi commented Feb 15, 2020

Currently, the error message I get from the parser import failure is confusing.

If I try to use VM functionality, I get an error Couldn't find ANTLR parser. Try building with USE_ANTLR=ON. But even if I rebuild TVM with USE_ANTLR=ON, I still get the same error because the generated parser try to import the antlr4 python package that I haven't installed, but the error still says Try building with USE_ANTLR=ON.

This is confusing, I think

try:
    from antlr4 import InputStream, CommonTokenStream
    from antlr4.error.ErrorListener import ErrorListener
except ImportError:
    raise Exception("Couldn't find ANTLR runtime." +
                    "Try running `pip{version} install antlr4-python{version}-runtime`."
                    .format(version=PYTHON_VERSION))

should come before

try:
    from .grammar.py3.RelayVisitor import RelayVisitor
    from .grammar.py3.RelayParser import RelayParser
    from .grammar.py3.RelayLexer import RelayLexer
except ImportError:
    raise Exception("Couldn't find ANTLR parser. Try building with USE_ANTLR=ON.")

because the latter depends on the antlr4 python package.

please review @wweic @zhiics @icemelon9

Copy link
Member

@icemelon icemelon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@icemelon icemelon merged commit 7e9ec73 into apache:master Feb 15, 2020
@icemelon
Copy link
Member

Thanks @masahi

alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 26, 2020
alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 28, 2020
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants