liyucheng09/Selective_Context

Import error even if we do : "import selective_context"

Sriharsha-hatwar opened this issue · 6 comments

ImportError: cannot import name 'SelectiveContext' from partially initialized module 'selective_context' (most likely due to a circular import) (/work/experiments/shatwar/llm-context/src/selective_context.py)

I am trying to run the command as stated in the README.md but facing this issue after installing from pypi

from selective_context import SelectiveContext

Python version = 3.8

Have you solved the problem?

I cannot reproduce your issue. Please provide the complete error message.

Hey, I am able to solve the issue by directly integrating my codebase with your work. However, the pip package seems to be still broken. as a testing mechanism, can you please create an env and install as per the instruction given in the readme? I was able to repro the issue with just that. Let me know if you need more info.

could you share your full error message.

Hey, so the error comes exactly the same as the one in comment 1.

As soon as I do this : from selective_context import SelectiveContext , I get this :

ImportError: cannot import name 'SelectiveContext' from partially initialized module 'selective_context' (most likely due to a circular import) (/work/experiments/shatwar/llm-context/src/selective_context.py)

Thats it, thats the error.

I have check the pip package and it is unlikely to have circular import issue. I suspect you have a file named selective_context.py which requires import from selective_context?

Ah, you are actually correct. Apologies. I am not sure why I did not think of this, the issue can be closed. But rest assure, I was able to include your codebase and I was able to make a work-around. Also, I believe there is an issue when it comes to installing en_core_web_sm package when the python is having 3.11+, which stems from the line :
self.nlp = spacy.load("en_core_web_sm", disable=["ner"]), I will create another issue if I am able to repro this issue.