langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
95.19k stars 15.44k forks source link

can not install langchain when docling is installed #28283

Open ryotaro-ikeda0 opened 9 hours ago

ryotaro-ikeda0 commented 9 hours ago

Checked other resources

Example Code

poetry add docling==0.2.7 langchain=0.3.1

Error Message and Stack Trace (if applicable)

Because no versions of langchain match >0.3.7,<0.4.0 and langchain (0.3.7) depends on numpy (>=1.26.0,<2.0.0), langchain (>=0.3.7,<0.4.0) requires numpy (>=1.26.0,<2.0.0). Because deepsearch-glm (0.26.1) depends on numpy (>=2.0.2,<3.0.0) and no versions of deepsearch-glm match >0.26.1,<0.27.0, deepsearch-glm (>=0.26.1,<0.27.0) requires numpy (>=2.0.2,<3.0.0). Thus, langchain (>=0.3.7,<0.4.0) is incompatible with deepsearch-glm (>=0.26.1,<0.27.0). And because docling (2.7.0) depends on deepsearch-glm (>=0.26.1,<0.27.0) and no versions of docling match >2.7.0,<3.0.0, langchain (>=0.3.7,<0.4.0) is incompatible with docling (>=2.7.0,<3.0.0). So, because nick-ai-batch depends on both docling (^2.7.0) and langchain (^0.3.7), version solving failed.

Description

I would like to install docling and langchain simultaneously:

$ poetry add docling langchain

However, the following error occurs:

Because no versions of langchain match >0.3.7,<0.4.0
 and langchain (0.3.7) depends on numpy (>=1.26.0,<2.0.0), langchain (>=0.3.7,<0.4.0) requires numpy (>=1.26.0,<2.0.0).
Because deepsearch-glm (0.26.1) depends on numpy (>=2.0.2,<3.0.0)
 and no versions of deepsearch-glm match >0.26.1,<0.27.0, deepsearch-glm (>=0.26.1,<0.27.0) requires numpy (>=2.0.2,<3.0.0).
Thus, langchain (>=0.3.7,<0.4.0) is incompatible with deepsearch-glm (>=0.26.1,<0.27.0).
And because docling (2.7.0) depends on deepsearch-glm (>=0.26.1,<0.27.0)
 and no versions of docling match >2.7.0,<3.0.0, langchain (>=0.3.7,<0.4.0) is incompatible with docling (>=2.7.0,<3.0.0).
So, because nick-ai-batch depends on both docling (^2.7.0) and langchain (^0.3.7), version solving failed.

When I check the numpy version requirements for deepsearch-glm (a dependency of docling), it is defined as follows:

$ poetry show deepsearch-glm --tree | grep numpy

>>>
│   ├── numpy >=2.0.2,<3.0.0 (circular dependency aborted here)
│   ├── numpy >=1.26.4,<2.0.0 (circular dependency aborted here)

However, for langchain, its dependency on numpy does not seem to handle circular dependency:

$ poetry show langchain --tree | grep numpy

>>>
├── numpy >=1.26.0,<2.0.0

On the other hand, if I install llama-index, it succeeds. Checking its dependency definitions for numpy, it seems to handle circular dependencies:

$ poetry show llama-index --tree | grep numpy

>>>
│   │   ├── numpy * 
│   │   ├── numpy * 
│   ├── numpy * 
│   │   ├── numpy * 
│       ├── numpy * 
│   ├── numpy * 
│   │   ├── numpy >=1.26.0 (circular dependency aborted here)
│   │   ├── numpy * 
│   │   ├── numpy * 
│   │   │   ├── numpy * 
│   │   ├── numpy * 
│   │   ├── numpy * 
│   │   ├── numpy >=1.26.0 (circular dependency aborted here)
│   │   ├── numpy * 

Would it be possible to address the circular dependency in langchain similarly?

System Info

System Information

OS: Darwin OS Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 Python Version: 3.12.7 (main, Nov 18 2024, 16:51:48) [Clang 15.0.0 (clang-1500.3.9.4)]

Package Information

langchain_core: 0.3.19 langsmith: 0.1.144

Optional packages not installed

langgraph langserve

Other Dependencies

httpx: 0.27.2 jsonpatch: 1.33 orjson: 3.10.11 packaging: 24.2 pydantic: 2.9.2 PyYAML: 6.0.2 requests: 2.32.3 requests-toolbelt: 1.0.0 tenacity: 8.5.0 typing-extensions: 4.12.2