[GH-ISSUE #924] Langchain python rag doc example Mac only #26210

Closed
opened 2026-04-22 02:16:10 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @technovangelist on GitHub (Oct 27, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/924

Originally assigned to: @technovangelist on GitHub.

The example requires a Mac only package but I think that's not actually the case.

Originally created by @technovangelist on GitHub (Oct 27, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/924 Originally assigned to: @technovangelist on GitHub. The example requires a Mac only package but I think that's not actually the case.
Author
Owner

@SoloBSD commented on GitHub (Oct 28, 2023):

This is on Linux Mint (latest)

====
python3 main.py
/home/memo/.local/lib/python3.10/site-packages/langchain/__init__.py:34: UserWarning: Importing PromptTemplate from langchain root module is no longer supported. Please use langchain.prompts.PromptTemplate instead.
// This was fixed by putting: from langchain.prompts import PromptTemplate
warnings.warn(
Traceback (most recent call last):
File "/home/memo/Projects/ollama/examples/langchain-python-rag-document/main.py", line 26, in
data = loader.load()
File "/home/memo/.local/lib/python3.10/site-packages/langchain/document_loaders/pdf.py", line 134, in load
return loader.load()
File "/home/memo/.local/lib/python3.10/site-packages/langchain/document_loaders/unstructured.py", line 86, in load
elements = self._get_elements()
File "/home/memo/.local/lib/python3.10/site-packages/langchain/document_loaders/pdf.py", line 57, in _get_elements
from unstructured.partition.pdf import partition_pdf
File "/home/memo/.local/lib/python3.10/site-packages/unstructured/partition/pdf.py", line 24, in
from pdfminer.utils import open_filename
ImportError: cannot import name 'open_filename' from 'pdfminer.utils' (/home/memo/.local/lib/python3.10/site-packages/pdfminer/utils.py)

<!-- gh-comment-id:1783933948 --> @SoloBSD commented on GitHub (Oct 28, 2023): This is on Linux Mint (latest) ==== python3 main.py /home/memo/.local/lib/python3.10/site-packages/langchain/__init__.py:34: UserWarning: Importing PromptTemplate from langchain root module is no longer supported. Please use langchain.prompts.PromptTemplate instead. **// This was fixed by putting: from langchain.prompts import PromptTemplate** warnings.warn( Traceback (most recent call last): File "/home/memo/Projects/ollama/examples/langchain-python-rag-document/main.py", line 26, in <module> data = loader.load() File "/home/memo/.local/lib/python3.10/site-packages/langchain/document_loaders/pdf.py", line 134, in load return loader.load() File "/home/memo/.local/lib/python3.10/site-packages/langchain/document_loaders/unstructured.py", line 86, in load elements = self._get_elements() File "/home/memo/.local/lib/python3.10/site-packages/langchain/document_loaders/pdf.py", line 57, in _get_elements from unstructured.partition.pdf import partition_pdf File "/home/memo/.local/lib/python3.10/site-packages/unstructured/partition/pdf.py", line 24, in <module> from pdfminer.utils import open_filename ImportError: cannot import name 'open_filename' from 'pdfminer.utils' (/home/memo/.local/lib/python3.10/site-packages/pdfminer/utils.py)
Author
Owner

@SoloBSD commented on GitHub (Oct 28, 2023):

I think it is fixed now:

  • Uninstalled pdfminer and installed pdfminer.six

Confirmed this is working!
Thanks!
You may close this issue.

<!-- gh-comment-id:1783936900 --> @SoloBSD commented on GitHub (Oct 28, 2023): I think it is fixed now: - Uninstalled pdfminer and installed pdfminer.six Confirmed this is working! Thanks! You may close this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26210