Closed AidPaike closed 11 months ago
🤖
Hello @AidPaike,
Welcome! I'm Dosu, an AI here to assist you with bugs, answer your questions, and help you become a better contributor while we wait for a human maintainer. I understand you're having an issue with CSVLoader
, don't worry, I'm going to look into this and will provide you with an answer shortly.
Issue you'd like to raise.
why CSVLoader can't load? error:
AttributeError Traceback (most recent call last) Cell In[25], line 1 ----> 1 from langchain.document_loaders.csv_loader import CSVLoader 3 loader = CSVLoader(file_path='./data/bugreport.csv', csv_args={ 4 'delimiter': ',', 5 'quotechar': '"', 6 'fieldnames': ["URL","Resolved","Backport_of","Submitted","Status","CPU","Priority","Sub_Component","Updated","Fix_Versions","Affected_Version","OS","Type","Resolution","Component"] 7 }) 9 data = loader.load()
File D:\miniconda\lib\site-packages\langchain\document_loadersinit.py:49 47 from langchain.document_loaders.bigquery import BigQueryLoader 48 from langchain.document_loaders.bilibili import BiliBiliLoader ---> 49 from langchain.document_loaders.blackboard import BlackboardLoader 50 from langchain.document_loaders.blob_loaders import ( 51 Blob, 52 BlobLoader, 53 FileSystemBlobLoader, 54 YoutubeAudioLoader, 55 ) 56 from langchain.document_loaders.blockchain import BlockchainDocumentLoader
File D:\miniconda\lib\site-packages\langchain\document_loaders\blackboard.py:1 ----> 1 from langchain_community.document_loaders.blackboard import BlackboardLoader 3 all = ["BlackboardLoader"]
File D:\miniconda\lib\site-packages\langchain_community\document_loadersinit.py:51 49 from langchain_community.document_loaders.bigquery import BigQueryLoader 50 from langchain_community.document_loaders.bilibili import BiliBiliLoader ---> 51 from langchain_community.document_loaders.blackboard import BlackboardLoader 52 from langchain_community.document_loaders.blob_loaders import ( 53 Blob, 54 BlobLoader, 55 FileSystemBlobLoader, 56 YoutubeAudioLoader, 57 ) 58 from langchain_community.document_loaders.blockchain import BlockchainDocumentLoader
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\blackboard.py:10 7 from langchain_core.documents import Document 9 from langchain_community.document_loaders.directory import DirectoryLoader ---> 10 from langchain_community.document_loaders.pdf import PyPDFLoader 11 from langchain_community.document_loaders.web_base import WebBaseLoader 14 class BlackboardLoader(WebBaseLoader):
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\pdf.py:18 16 from langchain_community.document_loaders.base import BaseLoader 17 from langchain_community.document_loaders.blob_loaders import Blob ---> 18 from langchain_community.document_loaders.parsers.pdf import ( 19 AmazonTextractPDFParser, 20 DocumentIntelligenceParser, 21 PDFMinerParser, 22 PDFPlumberParser, 23 PyMuPDFParser, 24 PyPDFium2Parser, 25 PyPDFParser, 26 ) 27 from langchain_community.document_loaders.unstructured import UnstructuredFileLoader 29 logger = logging.getLogger(file)
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\parsersinit.py:5 3 from langchain_community.document_loaders.parsers.grobid import GrobidParser 4 from langchain_community.document_loaders.parsers.html import BS4HTMLParser ----> 5 from langchain_community.document_loaders.parsers.language import LanguageParser 6 from langchain_community.document_loaders.parsers.pdf import ( 7 PDFMinerParser, 8 PDFPlumberParser, (...) 11 PyPDFParser, 12 ) 14 all = [ 15 "BS4HTMLParser", 16 "DocAIParser", (...) 24 "PyPDFParser", 25 ]
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\parsers\languageinit.py:1 ----> 1 from langchain_community.document_loaders.parsers.language.language_parser import ( 2 LanguageParser, 3 ) 5 all = ["LanguageParser"]
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\parsers\language\language_parser.py:24 18 try: 19 from langchain.text_splitter import Language 21 LANGUAGE_EXTENSIONS: Dict[str, str] = { 22 "py": Language.PYTHON, 23 "js": Language.JS, ---> 24 "cobol": Language.COBOL, 25 } 27 LANGUAGE_SEGMENTERS: Dict[str, Any] = { 28 Language.PYTHON: PythonSegmenter, 29 Language.JS: JavaScriptSegmenter, 30 Language.COBOL: CobolSegmenter, 31 } 32 except ImportError:
File D:\miniconda\lib\enum.py:437, in EnumMeta.getattr(cls, name) 435 return cls._membermap[name] 436 except KeyError: --> 437 raise AttributeError(name) from None
AttributeError: COBOL
Suggestion:
No response
langchain 0.0.352
QAQ After reloading the Jupyter server, the error no longer persists.
v0.1.0 fixed the issue for us.
I am having similar Issue. I have restarted the notebook but still its not working. langchain 0.0.309 langchain-community 0.0.10 langchain-core 0.1.8 Python 3.8.10
from langchain_community.document_loaders import TextLoader
loader = TextLoader("data/data.txt")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[16], line 1
----> 1 from langchain_community.document_loaders import TextLoader
3 loader = TextLoader("data/data.txt")
File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/__init__.py:51
49 from langchain_community.document_loaders.bigquery import BigQueryLoader
50 from langchain_community.document_loaders.bilibili import BiliBiliLoader
---> 51 from langchain_community.document_loaders.blackboard import BlackboardLoader
52 from langchain_community.document_loaders.blob_loaders import (
53 Blob,
54 BlobLoader,
55 FileSystemBlobLoader,
56 YoutubeAudioLoader,
57 )
58 from langchain_community.document_loaders.blockchain import BlockchainDocumentLoader
File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/blackboard.py:10
7 from langchain_core.documents import Document
9 from langchain_community.document_loaders.directory import DirectoryLoader
---> 10 from langchain_community.document_loaders.pdf import PyPDFLoader
11 from langchain_community.document_loaders.web_base import WebBaseLoader
14 class BlackboardLoader(WebBaseLoader):
File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/pdf.py:18
16 from langchain_community.document_loaders.base import BaseLoader
17 from langchain_community.document_loaders.blob_loaders import Blob
---> 18 from langchain_community.document_loaders.parsers.pdf import (
19 AmazonTextractPDFParser,
20 DocumentIntelligenceParser,
21 PDFMinerParser,
22 PDFPlumberParser,
23 PyMuPDFParser,
24 PyPDFium2Parser,
25 PyPDFParser,
26 )
27 from langchain_community.document_loaders.unstructured import UnstructuredFileLoader
29 logger = logging.getLogger(__file__)
File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/parsers/__init__.py:8
6 from langchain_community.document_loaders.parsers.grobid import GrobidParser
7 from langchain_community.document_loaders.parsers.html import BS4HTMLParser
----> 8 from langchain_community.document_loaders.parsers.language import LanguageParser
9 from langchain_community.document_loaders.parsers.pdf import (
10 PDFMinerParser,
11 PDFPlumberParser,
(...)
14 PyPDFParser,
15 )
17 __all__ = [
18 "AzureAIDocumentIntelligenceParser",
19 "BS4HTMLParser",
(...)
28 "PyPDFParser",
29 ]
File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/parsers/language/__init__.py:1
----> 1 from langchain_community.document_loaders.parsers.language.language_parser import (
2 LanguageParser,
3 )
5 __all__ = ["LanguageParser"]
File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/parsers/language/language_parser.py:24
18 try:
19 from langchain.text_splitter import Language
21 LANGUAGE_EXTENSIONS: Dict[str, str] = {
22 "py": Language.PYTHON,
23 "js": Language.JS,
---> 24 "cobol": Language.COBOL,
25 }
27 LANGUAGE_SEGMENTERS: Dict[str, Any] = {
28 Language.PYTHON: PythonSegmenter,
29 Language.JS: JavaScriptSegmenter,
30 Language.COBOL: CobolSegmenter,
31 }
32 except ImportError:
File /usr/lib/python3.8/enum.py:384, in EnumMeta.__getattr__(cls, name)
382 return cls._member_map_[name]
383 except KeyError:
--> 384 raise AttributeError(name) from None
AttributeError: COBOL
I am having similar Issue. I have restarted the notebook but still its not working. langchain 0.0.309 langchain-community 0.0.10 langchain-core 0.1.8 Python 3.8.10
from langchain_community.document_loaders import TextLoader loader = TextLoader("data/data.txt") --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[16], line 1 ----> 1 from langchain_community.document_loaders import TextLoader 3 loader = TextLoader("data/data.txt") File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/__init__.py:51 49 from langchain_community.document_loaders.bigquery import BigQueryLoader 50 from langchain_community.document_loaders.bilibili import BiliBiliLoader ---> 51 from langchain_community.document_loaders.blackboard import BlackboardLoader 52 from langchain_community.document_loaders.blob_loaders import ( 53 Blob, 54 BlobLoader, 55 FileSystemBlobLoader, 56 YoutubeAudioLoader, 57 ) 58 from langchain_community.document_loaders.blockchain import BlockchainDocumentLoader File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/blackboard.py:10 7 from langchain_core.documents import Document 9 from langchain_community.document_loaders.directory import DirectoryLoader ---> 10 from langchain_community.document_loaders.pdf import PyPDFLoader 11 from langchain_community.document_loaders.web_base import WebBaseLoader 14 class BlackboardLoader(WebBaseLoader): File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/pdf.py:18 16 from langchain_community.document_loaders.base import BaseLoader 17 from langchain_community.document_loaders.blob_loaders import Blob ---> 18 from langchain_community.document_loaders.parsers.pdf import ( 19 AmazonTextractPDFParser, 20 DocumentIntelligenceParser, 21 PDFMinerParser, 22 PDFPlumberParser, 23 PyMuPDFParser, 24 PyPDFium2Parser, 25 PyPDFParser, 26 ) 27 from langchain_community.document_loaders.unstructured import UnstructuredFileLoader 29 logger = logging.getLogger(__file__) File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/parsers/__init__.py:8 6 from langchain_community.document_loaders.parsers.grobid import GrobidParser 7 from langchain_community.document_loaders.parsers.html import BS4HTMLParser ----> 8 from langchain_community.document_loaders.parsers.language import LanguageParser 9 from langchain_community.document_loaders.parsers.pdf import ( 10 PDFMinerParser, 11 PDFPlumberParser, (...) 14 PyPDFParser, 15 ) 17 __all__ = [ 18 "AzureAIDocumentIntelligenceParser", 19 "BS4HTMLParser", (...) 28 "PyPDFParser", 29 ] File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/parsers/language/__init__.py:1 ----> 1 from langchain_community.document_loaders.parsers.language.language_parser import ( 2 LanguageParser, 3 ) 5 __all__ = ["LanguageParser"] File ~/venvs/global/lib/python3.8/site-packages/langchain_community/document_loaders/parsers/language/language_parser.py:24 18 try: 19 from langchain.text_splitter import Language 21 LANGUAGE_EXTENSIONS: Dict[str, str] = { 22 "py": Language.PYTHON, 23 "js": Language.JS, ---> 24 "cobol": Language.COBOL, 25 } 27 LANGUAGE_SEGMENTERS: Dict[str, Any] = { 28 Language.PYTHON: PythonSegmenter, 29 Language.JS: JavaScriptSegmenter, 30 Language.COBOL: CobolSegmenter, 31 } 32 except ImportError: File /usr/lib/python3.8/enum.py:384, in EnumMeta.__getattr__(cls, name) 382 return cls._member_map_[name] 383 except KeyError: --> 384 raise AttributeError(name) from None AttributeError: COBOL
same here. Any solution?
Python 3.9.12
from langchain_community.document_loaders import JSONLoader
raise AttributeError(name) from None AttributeError: COBOL
Anyone knows how to fix this?
Same issue while only importing "UnstructuredURLLoader" Checking in JP notebook with Anaconda (Windows 11) (Working fine in PyCharm, Individual setup for same machine)
from langchain_community.document_loaders import UnstructuredURLLoader
~\anaconda3\lib\enum.py in __getattr__(cls, name)
427 return cls._member_map_[name]
428 except KeyError:
--> 429 raise AttributeError(name) from None
430
431 def __getitem__(cls, name):
AttributeError: COBOL
I have same issue , I just upgrade langchain package and it worked for me
pip3 install --upgrade langchain
Issue you'd like to raise.
why CSVLoader can't load? error:
AttributeError Traceback (most recent call last) Cell In[25], line 1 ----> 1 from langchain.document_loaders.csv_loader import CSVLoader 3 loader = CSVLoader(file_path='./data/bugreport.csv', csv_args={ 4 'delimiter': ',', 5 'quotechar': '"', 6 'fieldnames': ["URL","Resolved","Backport_of","Submitted","Status","CPU","Priority","Sub_Component","Updated","Fix_Versions","Affected_Version","OS","Type","Resolution","Component"] 7 }) 9 data = loader.load()
File D:\miniconda\lib\site-packages\langchain\document_loaders__init__.py:49 47 from langchain.document_loaders.bigquery import BigQueryLoader 48 from langchain.document_loaders.bilibili import BiliBiliLoader ---> 49 from langchain.document_loaders.blackboard import BlackboardLoader 50 from langchain.document_loaders.blob_loaders import ( 51 Blob, 52 BlobLoader, 53 FileSystemBlobLoader, 54 YoutubeAudioLoader, 55 ) 56 from langchain.document_loaders.blockchain import BlockchainDocumentLoader
File D:\miniconda\lib\site-packages\langchain\document_loaders\blackboard.py:1 ----> 1 from langchain_community.document_loaders.blackboard import BlackboardLoader 3 all = ["BlackboardLoader"]
File D:\miniconda\lib\site-packages\langchain_community\document_loaders__init__.py:51 49 from langchain_community.document_loaders.bigquery import BigQueryLoader 50 from langchain_community.document_loaders.bilibili import BiliBiliLoader ---> 51 from langchain_community.document_loaders.blackboard import BlackboardLoader 52 from langchain_community.document_loaders.blob_loaders import ( 53 Blob, 54 BlobLoader, 55 FileSystemBlobLoader, 56 YoutubeAudioLoader, 57 ) 58 from langchain_community.document_loaders.blockchain import BlockchainDocumentLoader
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\blackboard.py:10 7 from langchain_core.documents import Document 9 from langchain_community.document_loaders.directory import DirectoryLoader ---> 10 from langchain_community.document_loaders.pdf import PyPDFLoader 11 from langchain_community.document_loaders.web_base import WebBaseLoader 14 class BlackboardLoader(WebBaseLoader):
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\pdf.py:18 16 from langchain_community.document_loaders.base import BaseLoader 17 from langchain_community.document_loaders.blob_loaders import Blob ---> 18 from langchain_community.document_loaders.parsers.pdf import ( 19 AmazonTextractPDFParser, 20 DocumentIntelligenceParser, 21 PDFMinerParser, 22 PDFPlumberParser, 23 PyMuPDFParser, 24 PyPDFium2Parser, 25 PyPDFParser, 26 ) 27 from langchain_community.document_loaders.unstructured import UnstructuredFileLoader 29 logger = logging.getLogger(file)
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\parsers__init.py:5 3 from langchain_community.document_loaders.parsers.grobid import GrobidParser 4 from langchain_community.document_loaders.parsers.html import BS4HTMLParser ----> 5 from langchain_community.document_loaders.parsers.language import LanguageParser 6 from langchain_community.document_loaders.parsers.pdf import ( 7 PDFMinerParser, 8 PDFPlumberParser, (...) 11 PyPDFParser, 12 ) 14 all__ = [ 15 "BS4HTMLParser", 16 "DocAIParser", (...) 24 "PyPDFParser", 25 ]
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\parsers\language__init__.py:1 ----> 1 from langchain_community.document_loaders.parsers.language.language_parser import ( 2 LanguageParser, 3 ) 5 all = ["LanguageParser"]
File D:\miniconda\lib\site-packages\langchain_community\document_loaders\parsers\language\language_parser.py:24 18 try: 19 from langchain.text_splitter import Language 21 LANGUAGE_EXTENSIONS: Dict[str, str] = { 22 "py": Language.PYTHON, 23 "js": Language.JS, ---> 24 "cobol": Language.COBOL, 25 } 27 LANGUAGE_SEGMENTERS: Dict[str, Any] = { 28 Language.PYTHON: PythonSegmenter, 29 Language.JS: JavaScriptSegmenter, 30 Language.COBOL: CobolSegmenter, 31 } 32 except ImportError:
File D:\miniconda\lib\enum.py:437, in EnumMeta.getattr(cls, name) 435 return cls._membermap[name] 436 except KeyError: --> 437 raise AttributeError(name) from None
AttributeError: COBOL
Suggestion:
No response