Skip to content

'from docling.chunking import HybridChunker' fails: No module named 'tree_sitter' #781

Description

@yurivict

The user has this problem with docling-chunker:

I'm having the following error trying tu use Docling:

 from docling.chunking import HybridChunker
   File "/usr/local/lib/python3.12/site-packages/docling/chunking/__init__.py", line 9, in <module>  
 from docling_core.transforms.chunker.base import BaseChunk, BaseChunker, BaseMeta
   File "/usr/local/lib/python3.12/site-packages/docling_core/transforms/chunker/__init__.py", line 12, in <module>
 from docling_core.transforms.chunker.code_chunking.standard_code_chunking_strategy import (
   File "/usr/local/lib/python3.12/site-packages/docling_core/transforms/chunker/code_chunking/standard_code_chunking_strategy.py", line 8, in <module>
 from docling_core.transforms.chunker.code_chunking._language_code_chunkers import (
   File "/usr/local/lib/python3.12/site-packages/docling_core/transforms/chunker/code_chunking/_language_code_chunkers.py", line 8, in <module>
 from tree_sitter import Node, Parser, Tree ModuleNotFoundError: No module named 'tree_sitter'

ChatGPT says:

 * HybridChunker cannot even be imported because tree_sitter is absent.
 * Upstream declares Tree-sitter, grammar packages, semchunk, and transformers in the chunking extra.
 * The FreeBSD port installs only the base docling-core dependencies.
 * The immediate fix depends on PR 289772 because current Docling requires a newer Tree-sitter API (tree-sitter >= 0.25)
 * Additional ports may be needed for tree-sitter-c and tree-sitter-typescript.

The FreeBSD port has all required dependencies, but optional dependencies are used and they are missing.
If they are used in the course of normal operation, why are they optional?

Please all imports used in the code required dependencies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions