tree-sitter / py-tree-sitter

Python bindings to the Tree-sitter parsing library
https://tree-sitter.github.io/py-tree-sitter/
MIT License
817 stars 96 forks source link

Cannot install git version #267

Closed simon-friedberger closed 1 month ago

simon-friedberger commented 1 month ago

Installing with pip install tree-sitter-python is giving

ERROR: Could not find a version that satisfies the requirement tree-sitter-python (from versions: none)
ERROR: No matching distribution found for tree-sitter-python

Maybe I am missing some steps but I couldn't find anything in the readme so I tried to install from git with pip install . and got

      In file included from tree_sitter/binding/language.c:1:
      tree_sitter/binding/types.h:3:10: fatal error: 'tree_sitter/api.h' file not found
      #include "tree_sitter/api.h"

It would be great to provide some steps on how to install this. (Note: These may be ARM Mac specific issues.)

simon-friedberger commented 1 month ago

@ObserverOfTime Would you at least clarify what my misunderstanding here is or why this is invalid?

ObserverOfTime commented 1 month ago

Would you at least check the existing issues?

simon-friedberger commented 1 month ago

Apologies, I had gone through the open issues but nothing seemed related.

Looking at the closed issues there seem to be some similar ones:

and the solution seems to be in https://github.com/tree-sitter/tree-sitter-python/issues/262#issuecomment-2077638647:

pip install git+https://github.com/tree-sitter/tree-sitter-python

which is a different repo. I'm confused about what is going on here. This repo is described as:

This module provides Python bindings to the tree-sitter parsing library.

and tree-sitter/tree-sitter-python is described as

Python grammar for tree-sitter.

So, if I want to use tree sitter from Python don't I need the bindings which are in this repo?

Apologies, if this was wrong in my initial comment. I was confused by the naming.