求助11月15号课程上的实例在windows上运行Langchain_RAGProject-main时报错ImportError: failed to find libmagic. Check your installation #386

Closed
opened 2024-11-20 09:32:00 +08:00 by slxx · 2 comments

Traceback (most recent call last):
File "C:\Python310\lib\site-packages\gradio\queueing.py", line 624, in process_events
response = await route_utils.call_process_api(
File "C:\Python310\lib\site-packages\gradio\route_utils.py", line 323, in call_process_api
output = await app.get_blocks().process_api(
File "C:\Python310\lib\site-packages\gradio\blocks.py", line 2018, in process_api
result = await self.call_function(
File "C:\Python310\lib\site-packages\gradio\blocks.py", line 1567, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "C:\Python310\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "C:\Python310\lib\site-packages\anyio_backends_asyncio.py", line 2357, in run_sync_in_worker_thread
return await future
File "C:\Python310\lib\site-packages\anyio_backends_asyncio.py", line 864, in run
result = context.run(func, *args)
File "C:\Python310\lib\site-packages\gradio\utils.py", line 846, in wrapper
response = f(*args, **kwargs)
File "d:\文件\唐总发的关于AI学习视频\20241115\Langchain_RAGProject-main\Langchain_RAGProject-main\src\Knowledge.py", line 55, in upload_knowledge
self.create_indexes(collection_name, file_path)
File "d:\文件\唐总发的关于AI学习视频\20241115\Langchain_RAGProject-main\Langchain_RAGProject-main\src\Knowledge.py", line 94, in create_indexes
loader = DocumentChunker(file_path)
File "d:\文件\唐总发的关于AI学习视频\20241115\Langchain_RAGProject-main\Langchain_RAGProject-main\src\DocumentChunker.py", line 31, in init
self.file_type_ = detect_filetype(file_path)
File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 98, in detect_filetype
return _FileTypeDetector.file_type(ctx)
File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 131, in file_type
return cls(ctx)._file_type
File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 141, in _file_type
if file_type := self._file_type_from_guessed_mime_type:
File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 181, in _file_type_from_guessed_mime_type
mime_type = self._ctx.mime_type
File "C:\Python310\lib\site-packages\unstructured\utils.py", line 154, in get
value = self.fget(obj)
File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 362, in mime_type
import magic
File "C:\Python310\lib\site-packages\magic_init
.py", line 209, in
libmagic = loader.load_lib()
File "C:\Python310\lib\site-packages\magic\loader.py", line 49, in load_lib
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation

Traceback (most recent call last): File "C:\Python310\lib\site-packages\gradio\queueing.py", line 624, in process_events response = await route_utils.call_process_api( File "C:\Python310\lib\site-packages\gradio\route_utils.py", line 323, in call_process_api output = await app.get_blocks().process_api( File "C:\Python310\lib\site-packages\gradio\blocks.py", line 2018, in process_api result = await self.call_function( File "C:\Python310\lib\site-packages\gradio\blocks.py", line 1567, in call_function prediction = await anyio.to_thread.run_sync( # type: ignore File "C:\Python310\lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "C:\Python310\lib\site-packages\anyio\_backends\_asyncio.py", line 2357, in run_sync_in_worker_thread return await future File "C:\Python310\lib\site-packages\anyio\_backends\_asyncio.py", line 864, in run result = context.run(func, *args) File "C:\Python310\lib\site-packages\gradio\utils.py", line 846, in wrapper response = f(*args, **kwargs) File "d:\文件\唐总发的关于AI学习视频\20241115\Langchain_RAGProject-main\Langchain_RAGProject-main\src\Knowledge.py", line 55, in upload_knowledge self.create_indexes(collection_name, file_path) File "d:\文件\唐总发的关于AI学习视频\20241115\Langchain_RAGProject-main\Langchain_RAGProject-main\src\Knowledge.py", line 94, in create_indexes loader = DocumentChunker(file_path) File "d:\文件\唐总发的关于AI学习视频\20241115\Langchain_RAGProject-main\Langchain_RAGProject-main\src\DocumentChunker.py", line 31, in __init__ self.file_type_ = detect_filetype(file_path) File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 98, in detect_filetype return _FileTypeDetector.file_type(ctx) File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 131, in file_type return cls(ctx)._file_type File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 141, in _file_type if file_type := self._file_type_from_guessed_mime_type: File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 181, in _file_type_from_guessed_mime_type mime_type = self._ctx.mime_type File "C:\Python310\lib\site-packages\unstructured\utils.py", line 154, in __get__ value = self._fget(obj) File "C:\Python310\lib\site-packages\unstructured\file_utils\filetype.py", line 362, in mime_type import magic File "C:\Python310\lib\site-packages\magic\__init__.py", line 209, in <module> libmagic = loader.load_lib() File "C:\Python310\lib\site-packages\magic\loader.py", line 49, in load_lib raise ImportError('failed to find libmagic. Check your installation') ImportError: failed to find libmagic. Check your installation

pip uninstall python-magic
pip install python-magic-bin==0.4.14

pip uninstall python-magic pip install python-magic-bin==0.4.14

pip install python-magic-bin==0.4.14,在autodl执行报错,python3.10、3.11均报错image

pip install python-magic-bin==0.4.14,在autodl执行报错,python3.10、3.11均报错![image](/attachments/a9908de5-5aab-42ba-add1-5c3de38236dd)
slxx closed this issue 2024-11-28 17:21:51 +08:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: HswOAuth/llm_course#386
No description provided.