DS4SD / docling

Get your documents ready for gen AI
https://ds4sd.github.io/docling
MIT License
11k stars 536 forks source link

Error Installing docling (>=2.4.1,<3.0.0) in project with langchain dependency #283

Closed souzatharsis closed 2 weeks ago

souzatharsis commented 2 weeks ago

Bug

Installing docling (>=2.4.1,<3.0.0) in a project with langchain (any version) dependency fails.

  1. Because langchain depends on numpy (>=1.26.0,<2.0.0)
  2. Because cocling (>=2.4.1,<3.0.0) requires numpy (>=2.0.2,<3.0.0)

So, because my project depends on both langchain (^0.3.3) and numpy (>=2.0.2,<3.0.0), version solving failed.

Steps to reproduce

poetry add langchain
poetry add docling

Docling version

(>=2.4.1,<3.0.0)

Python version

Python 3.11

souzatharsis commented 2 weeks ago

Is there a way we can use docling with numpy (>=1.26.0,<2.0.0) while langchain does not upgrade to numpy (>=2.0.0) to enable docling/langchain integration?

souzatharsis commented 2 weeks ago

same with langchain-community

souzatharsis commented 2 weeks ago

Since docling for content generation for llms is an important use case Since langchain is the most used llm framework today We would love your help in solving this critical issue.

Thanks!

vagenas commented 2 weeks ago

@souzatharsis,

TLDR: Check if Python 3.13 is among the Python versions allowed by your pyproject.toml and if so, remove it and try again. E.g., if you have python = "^3.10", use python = ">=3.10,<3.13" instead.

Details: Numpy is only adding Python 3.13 support starting in some 2.x.y version. In order to prepare for 3.13, Docling depends on a 2.x.y for 3.13, otherwise depending an 1.x.y version (source). If you are allowing 3.13 in your pyproject.toml, Poetry will try to find some way to reconcile Docling's numpy version for 3.13 (some 2.x.y) with LangChain's version for that (some 1.x.y) — leading to the error above.

Let me know if that helped.

👉 Also keep an eye on our recent LangChain PR: we expect to have native LangChain support very soon 😉

souzatharsis commented 2 weeks ago

Thank you so much; that resolved the issue!