ImportError: circular import? #42

Closed
opened 2026-02-16 00:16:42 -05:00 by yindo · 1 comment
Owner

Originally created by @hemanth on GitHub (Mar 13, 2024).

See the below error with llama-parse-0.3.9

~/labs via 🐍 v3.10.12 took 3s 
❯ python llama_parse.py 
Traceback (most recent call last):
  File "/Users/hemanth/labs/llama_parse.py", line 4, in <module>
    from llama_parse import LlamaParse
  File "/Users/hemanth/labs/llama_parse.py", line 4, in <module>
    from llama_parse import LlamaParse
ImportError: cannot import name 'LlamaParse' from partially initialized module 'llama_parse' (most likely due to a circular import) (/Users/hemanth/labs/llama_parse.py)

for:

import nest_asyncio
nest_asyncio.apply()

from llama_parse import LlamaParse

parser = LlamaParse(
    api_key="llx-key",  
    result_type="markdown", 
    num_workers=4, 
    verbose=True,
    language="en"
)

documents = parser.load_data("./my.pdf")
Originally created by @hemanth on GitHub (Mar 13, 2024). See the below error with `llama-parse-0.3.9` ```sh ~/labs via 🐍 v3.10.12 took 3s ❯ python llama_parse.py Traceback (most recent call last): File "/Users/hemanth/labs/llama_parse.py", line 4, in <module> from llama_parse import LlamaParse File "/Users/hemanth/labs/llama_parse.py", line 4, in <module> from llama_parse import LlamaParse ImportError: cannot import name 'LlamaParse' from partially initialized module 'llama_parse' (most likely due to a circular import) (/Users/hemanth/labs/llama_parse.py) ``` for: ```py import nest_asyncio nest_asyncio.apply() from llama_parse import LlamaParse parser = LlamaParse( api_key="llx-key", result_type="markdown", num_workers=4, verbose=True, language="en" ) documents = parser.load_data("./my.pdf") ```
yindo closed this issue 2026-02-16 00:16:42 -05:00
Author
Owner

@mlkorra commented on GitHub (Mar 14, 2024):

@hemanth the issue here is due to filename of your .py script (it's same as llama_parse) , rename that and issue gets resolved.

@mlkorra commented on GitHub (Mar 14, 2024): @hemanth the issue here is due to filename of your .py script (it's same as `llama_parse`) , rename that and issue gets resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#42