chat-langchain icon indicating copy to clipboard operation
chat-langchain copied to clipboard

cannot import name 'AsyncCallbackManager' from 'langchain.callbacks.base' (/Users/friahi/Library/Python/3.9/lib/python/site-packages/langchain/callbacks/base.py)

Open friahi65 opened this issue 2 years ago • 12 comments

the versions in the requirement files were not locked, so the AsyncCallbackManager no longer exists in the langchain/callbacks/base.py.

friahi65 avatar May 01 '23 17:05 friahi65

could u tell me which version I need?

dahaoGPT avatar May 01 '23 17:05 dahaoGPT

I don't know either, it has to go through langchain and see which version had that AsyncCallbackManager or update the code to the newest version of langchain

friahi65 avatar May 01 '23 18:05 friahi65

'AsyncCallbackManager' can be imported from 'langchain.callbacks.manager' now instead. At least worked for me.

completelyboofyblitzed avatar May 01 '23 22:05 completelyboofyblitzed

'AsyncCallbackManager' can be imported from 'langchain.callbacks.manager' now instead. At least worked for me.

I'm getting this error, is there any further solution? ERROR:root:maximum recursion depth exceeded

SilverNine avatar May 02 '23 00:05 SilverNine

I managed to run the project (langchain==0.0.154) with the following changes:

  • from langchain.callbacks.manager import AsyncCallbackManager
  • ERROR:root:maximum recursion depth exceeded: Using shallow copy instead of deep copy (copy.deepcopy ->copy.copy) in manager.py#L719. It's a problem copying websocket in StreamingLLMCallbackHandler and QuestionGenCallbackHandler. I think there are other ways that doesn't require to change langchain code, just make sure deepcopy work.
  • Using ConversationalRetrievalChain instead of ChatVectorDBChain like this pull request

HKAB avatar May 02 '23 13:05 HKAB

@HKAB did you use solutions for ERROR:root:ChatVectorDBChain does not support async from the pull request as well?

completelyboofyblitzed avatar May 02 '23 14:05 completelyboofyblitzed

@HKAB did you use solutions for ERROR:root:ChatVectorDBChain does not support async from the pull request as well?

Yes, I edited my answer.

HKAB avatar May 02 '23 14:05 HKAB

I managed to run the project (langchain==0.0.154) with the following changes:

  • from langchain.callbacks.manager import AsyncCallbackManager
  • ERROR:root:maximum recursion depth exceeded: Using shallow copy instead of deep copy (copy.deepcopy ->copy.copy) in manager.py#L719. It's a problem copying websocket in StreamingLLMCallbackHandler and QuestionGenCallbackHandler. I think there are other ways that doesn't require to change langchain code, just make sure deepcopy work.
  • Using ConversationalRetrievalChain instead of ChatVectorDBChain like this pull request

hi , i follow your second step and modify the source code ,but it does not work ,i still get the error'ERROR:root:maximum recursion depth exceeded', so what i can do more? image

i modify another (deepcopy->copy), it works now ,thx u.

dahaoGPT avatar May 02 '23 16:05 dahaoGPT

'AsyncCallbackManager' can be imported from 'langchain.callbacks.manager' now instead. At least worked for me.

I'm getting this error, is there any further solution? ERROR:root:maximum recursion depth exceeded

Resolved after updating to langchain==0.0.156.

SilverNine avatar May 03 '23 00:05 SilverNine

Still have this problem with langchain=0.0.188

xuanlinh91 avatar Jun 02 '23 02:06 xuanlinh91

I opened a PR to solve this issue #91

r0mdau avatar Jun 10 '23 20:06 r0mdau

langchain==0.0.150 solved the problem

ZhangYi1212 avatar Aug 09 '23 09:08 ZhangYi1212