langchain icon indicating copy to clipboard operation
langchain copied to clipboard

import error ContextualCompressionRetriever

Open youminxue opened this issue 1 year ago • 7 comments

System Info

m1 mac

Who can help?

@hwchase17 @agola11 @eyurtsev

Information

  • [ ] The official example notebooks/scripts
  • [X] My own modified scripts

Related Components

  • [ ] LLMs/Chat Models
  • [X] Embedding Models
  • [ ] Prompts / Prompt Templates / Prompt Selectors
  • [ ] Output Parsers
  • [ ] Document Loaders
  • [ ] Vector Stores / Retrievers
  • [ ] Memory
  • [ ] Agents / Agent Executors
  • [ ] Tools / Toolkits
  • [ ] Chains
  • [ ] Callbacks/Tracing
  • [ ] Async

Reproduction

from langchain.retrievers import ContextualCompressionRetriever

NameError: name 'v_args' is not defined

Expected behavior

image

youminxue avatar May 08 '23 03:05 youminxue

i had the same problem

yetilfx avatar May 08 '23 03:05 yetilfx

i had the same problem

+1

ruyiluo avatar May 08 '23 12:05 ruyiluo

This is because the lark dependency is not installed. If you look at where v_args is coming from it is from lark. It is an optional dependency for some reason. Installing it will fix your issue.

tasansal avatar May 09 '23 01:05 tasansal

+1.

The decorated func should probably be wrapped in some import/exception clause like for other optional libraries - thanks @tasansal for pointing out the source.

jphme avatar May 09 '23 13:05 jphme

Yea; it does have a try except but I think it has a bug. If it doesn't exist it just doesn't import it hence import error happens.

tasansal avatar May 09 '23 13:05 tasansal

cc @hwchase17 is this related to the fix you pushed yesterday if not, I'm happy to take a look let me know

eyurtsev avatar May 09 '23 14:05 eyurtsev

cc @hwchase17 is this related to the fix you pushed yesterday if not, I'm happy to take a look let me know

think it's unrelated, taking look now

dev2049 avatar May 09 '23 21:05 dev2049

Hi, @youminxue! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

Based on my understanding, the issue is about an import error for the ContextualCompressionRetriever module. It seems that the error message indicates that the name 'v_args' is not defined. Several users, including yetilfx and ruyiluo, have also experienced the same problem. tasansal suggests that the issue is caused by the missing lark dependency and recommends installing it to fix the problem. jphme agrees with tasansal and suggests wrapping the decorated function in an import/exception clause. eyurtsev and dev2049 mention other users to see if the issue is related to a recent fix.

Now, we would like to know if this issue is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution to the LangChain project! If you have any further questions or concerns, please don't hesitate to let us know.

dosubot[bot] avatar Sep 15 '23 16:09 dosubot[bot]