langchain-ai / langchain

πŸ¦œπŸ”— Build context-aware reasoning applications
https://python.langchain.com
MIT License
95.74k stars 15.55k forks source link

AsyncChromiumloader gives attribute error : COBOL #15524

Closed rogerbarretocode closed 10 months ago

rogerbarretocode commented 11 months ago

System Info

python 3.9.13

langchain==0.0.316 langchain-community==0.0.1 langchain-core==0.0.13

Who can help?

No response

Information

Related Components

Reproduction

import pprint

from langchain.text_splitter import RecursiveCharacterTextSplitter

from langchain_community.document_loaders import AsyncChromiumLoader from langchain_community.document_transformers import BeautifulSoupTransformer

from langchain.chains import create_extraction_chain

from langchain_community.chat_models import ChatOpenAI

Expected behavior

i am getting the following error when i try to import asyncchromiumloader

Traceback (most recent call last): File "C:\Users\roger\OneDrive\Desktop\testlinkedinllm.py", line 5, in from langchain_community.document_loaders import AsyncChromiumLoader File "C:\Users\roger\anaconda3new\lib\site-packages\langchain_community\document_loaders__init.py", line 51, in from langchain_community.document_loaders.blackboard import BlackboardLoader File "C:\Users\roger\anaconda3new\lib\site-packages\langchain_community\document_loaders\blackboard.py", line 10, in from langchain_community.document_loaders.pdf import PyPDFLoader File "C:\Users\roger\anaconda3new\lib\site-packages\langchain_community\document_loaders\pdf.py", line 18, in from langchain_community.document_loaders.parsers.pdf import ( File "C:\Users\roger\anaconda3new\lib\site-packages\langchain_community\document_loaders\parsers\init.py", line 5, in from langchain_community.document_loaders.parsers.language import LanguageParser File "C:\Users\roger\anaconda3new\lib\site-packages\langchain_community\document_loaders\parsers\language\init.py", line 1, in from langchain_community.document_loaders.parsers.language.language_parser import ( File "C:\Users\roger\anaconda3new\lib\site-packages\langchain_community\document_loaders\parsers\language\language_parser.py", line 24, in "cobol": Language.COBOL, File "C:\Users\roger\anaconda3new\lib\enum.py", line 429, in getattr__ raise AttributeError(name) from None AttributeError: COBOL

dosubot[bot] commented 11 months ago

πŸ€–

Hello @rogerbarretocode, it's good to see you here again! Let's dive into this issue.

Based on the traceback you provided, it seems like the error is originating from the language_parser.py file in the langchain_community.document_loaders.parsers.language module. Specifically, it's trying to access an attribute COBOL from the Language enum which doesn't seem to exist.

This could be due to a couple of reasons:

  1. The Language enum in your version of LangChain does not have a COBOL attribute. This could be because the COBOL attribute was added in a later version of LangChain. You mentioned that you're using LangChain version 0.0.316, but the latest version is 0.0.354. It's possible that updating to the latest version could resolve this issue.

  2. There's a bug in the language_parser.py file where it's trying to access a COBOL attribute that doesn't exist or hasn't been properly defined.

To resolve this issue, you could try the following steps:

  1. Update LangChain to the latest version (0.0.354) and see if the issue persists. You can do this by running pip install --upgrade langchain.

  2. If the issue persists after updating, it's likely a bug in the language_parser.py file. In this case, you could try commenting out the line where the COBOL attribute is accessed as a temporary workaround. However, this could potentially cause other issues if the COBOL attribute is required elsewhere in your code.

If neither of these steps resolve the issue, it would be helpful if you could provide more information about your code and how you're using the AsyncChromiumLoader class. Specifically, it would be helpful to know if you're using the COBOL attribute elsewhere in your code, and if so, how.

I hope this helps! If you have any other questions or need further clarification, please don't hesitate to ask.

-Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a πŸ‘ if this is helpful and πŸ‘Ž if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

sarthakmadhamshettiwar commented 10 months ago

I was facing the same problem when I was trying on a local machine, I switched to Colab and not its working fine. Not sure why this happened.

georgioooo commented 10 months ago

And me too i have the same problem

rogerbarretocode commented 10 months ago

My issue got fixed after uninstalling langchain and installing it again

dosubot[bot] commented 10 months ago

πŸ€–

Based on the traceback you provided, it seems like the error is originating from the langchain_community.document_loaders.parsers.language.language_parser module, specifically when it tries to access Language.COBOL. The Language enum might not have a COBOL attribute in the version of LangChain you're using.

However, you mentioned that the issue was resolved after reinstalling LangChain. This suggests that there might have been an issue with your previous installation of LangChain, possibly a version mismatch or a corrupted installation.

If you encounter this issue again, I would recommend checking the version of LangChain you're using and ensuring it's compatible with the langchain_community package. You can do this by running pip show langchain and pip show langchain_community in your terminal and comparing the versions.

Also, make sure that the Language enum in your version of LangChain includes a COBOL attribute. You can check this by navigating to the langchain_community.document_loaders.parsers.language.language_parser module in your LangChain installation and looking at the Language enum definition.

If the COBOL attribute is not present, you might need to update your version of LangChain or use a different attribute that's available in your version.

For more information, you can refer to the LangChain documentation and the source code of the langchain_community.document_loaders.parsers.language.language_parser module:

I hope this helps! If you have any more questions or need further clarification, feel free to ask.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a πŸ‘ if this is helpful and πŸ‘Ž if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

pven93 commented 9 months ago

I faced a similar issue but not for COBOL but for C language defined on the enum, got resolved after upgrading langchain version.