[New User] Lark import module error
See original GitHub issueWhat is your question?
Im new user of lark, Im tried to install lark and it was successful.
/git/apps/compiler » sudo -H pip install lark-parser
Collecting lark-parser
Downloading lark_parser-0.8.5-py2.py3-none-any.whl (72 kB)
|████████████████████████████████| 72 kB 1.5 MB/s
Installing collected packages: lark-parser
Successfully installed lark-parser-0.8.5
WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
You should consider upgrading via the '/usr/local/opt/python/bin/python3.7 -m pip install --upgrade pip' command.
~/git/apps/compiler » pip3 install lark-parser
Collecting lark-parser
Using cached lark_parser-0.8.5-py2.py3-none-any.whl (72 kB)
Installing collected packages: lark-parser
Successfully installed lark-parser-0.8.5
If you’re having trouble with your code or grammar
When i try to run a example from https://github.com/lark-parser/lark/blob/master/examples/fruitflies.py im getting the following error.
~/git/apps/compiler » python lark.py 1 ↵
Traceback (most recent call last):
File "lark.py", line 6, in <module>
from lark import Lark
File "/Users/aravindkumar/git/apps/compiler/lark.py", line 6, in <module>
from lark import Lark
ImportError: cannot import name 'Lark' from 'lark' (/Users/aravindkumar/git/apps/compiler/lark.py)
I even tried check the package execution status all looks good:
/usr/local/lib/python3.7/site-packages/lark » ls -al
total 304
drwxr-xr-x 21 root admin 672 May 5 02:15 .
drwxr-xr-x 681 aravindkumar admin 21792 May 5 02:15 ..
-rw-r--r-- 1 root admin 379 May 5 02:15 __init__.py
drwxr-xr-x 17 root admin 544 May 5 02:15 __pycache__
-rw-r--r-- 1 root admin 743 May 5 02:15 common.py
-rw-r--r-- 1 root admin 3906 May 5 02:15 exceptions.py
-rw-r--r-- 1 root admin 2793 May 5 02:15 grammar.py
drwxr-xr-x 3 root admin 96 May 5 02:15 grammars
-rw-r--r-- 1 root admin 1884 May 5 02:15 indenter.py
-rw-r--r-- 1 root admin 13158 May 5 02:15 lark.py
-rw-r--r-- 1 root admin 13599 May 5 02:15 lexer.py
-rw-r--r-- 1 root admin 31034 May 5 02:15 load_grammar.py
-rw-r--r-- 1 root admin 10450 May 5 02:15 parse_tree_builder.py
-rw-r--r-- 1 root admin 8214 May 5 02:15 parser_frontends.py
drwxr-xr-x 12 root admin 384 May 5 02:15 parsers
-rw-r--r-- 1 root admin 5655 May 5 02:15 reconstruct.py
-rw-r--r-- 1 root admin 5573 May 5 02:15 reconstruct2.py
drwxr-xr-x 7 root admin 224 May 5 02:15 tools
-rw-r--r-- 1 root admin 5182 May 5 02:15 tree.py
-rw-r--r-- 1 root admin 7529 May 5 02:15 utils.py
-rw-r--r-- 1 root admin 10987 May 5 02:15 visitors.py
I still cant figure whats wrong with the import. Need help here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Python3 Relative Import Is not Working - Stack Overflow
I'm new in python 3. I'm trying to run lark examples http://github.com/lark-parser/lark in a development mode, but was blocked on relative ...
Read more >How To Use Lark - Guide - Lark documentation - Read the Docs
Import Nearley. It is possible to import Nearley grammars into Lark. The Javascript code is translated using Js2Py. See the tools page for...
Read more >lark-parser/Lobby - Gitter
I am trying to implement an import statement in my lark code. The thing is, if the code to be parsed has the...
Read more >Text Parser for IronPython that I can use in Grasshopper
I've been looking for a parser module akin to Lark that I can use in ... but I get this runtime error when...
Read more >Server Error Codes - 服务端文档 - Documentation
Error Code Description Troubleshooting Suggestion
1002 Failed Deleted file cannot get document content
1665 internal error Internal error, please consult customer service
4002 definition not found...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can’t name your file
lark.py
. Python tries to import it and not the package.@tsbertalan Sadly, the name ‘lark’ is taken on pip, so we have to resort to ‘lark-parser’. You just need to be aware to not confuse the two packages.