Closed Co1lin closed 2 months ago
Building from source via tree-sitter is deprecated but you can still build from source via pip.
pip install git+https://github.com/tree-sitter/tree-sitter-python
A macOS arm64 wheel will be available in the next release. Maybe a source distribution as well.
Hello, just checking, could it be possible to get an sdist
otherwise ? I assume that would make arm-based fallback to source and build locally ?
That's what I've been doing in my pyproject.toml
tree-sitter-python = [
{platform = "darwin", git="https://github.com/tree-sitter/tree-sitter-python", tag="v0.21.0"},
{platform = "linux", version="0.21.0"}
]
pip install git+https://github.com/tree-sitter/tree-sitter-python
I tried this and still can't install it. How do I resolve this?
File "/Users/kiyoon/.config/dotfiles/nvim/find_python_import_in_project.py", line 6, in <module>
import tree_sitter_python as tspython
File "/Users/kiyoon/bin/miniforge3/envs/PPMI/lib/python3.11/site-packages/tree_sitter_python/__init__.py", line 3, in <module>
from ._binding import language
ImportError: dlopen(/Users/kiyoon/bin/miniforge3/envs/PPMI/lib/python3.11/site-packages/tree_sitter_python/_binding.abi3.so, 0x0002): tried: '/Users/kiyoon/bin/miniforge3/envs/PPMI/lib/python3.11/site-packages/tree_sitter_python/_binding.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/kiyoon/bin/miniforge3/envs/PPMI/lib/python3.11/site-packages/tree_sitter_python/_binding.abi3.so' (no such file), '/Users/kiyoon/bin/miniforge3/envs/PPMI/lib/python3.11/site-packages/tree_sitter_python/_binding.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
@kiyoon for intel mac you should be able to pip install tree-sitter
normally. Does that not work?
@tusharsadhwani Mine is M1, and it seems like the shared object that is being installed is for intel. pip install tree-sitter-python
didn't work for me.
🕙 21:02:13 ❯ pip install tree-sitter-python
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
🕙 21:02:15 ✖ uv pip install tree-sitter-python
× No solution found when resolving dependencies:
╰─▶ Because only tree-sitter-python==0.21.0 is available and tree-sitter-python==0.21.0 has no wheels are available with a matching platform, we can conclude that all versions of tree-sitter-python cannot be used.
And because you require tree-sitter-python, we can conclude that the requirements are unsatisfiable.
I tried this and still can't install it. How do I resolve this?
Something is using the wrong architecture. Could be python, pip, conda, or your compiler.
I think it's my compiler because I had similar problem with rust. But I don't know how to fix it..
I temporarily forked the repo and modified the CI to publish the wheel files on the Release page. I don't know what's wrong with my compiler, but this worked for me.
The wheel is included in 0.23.0
After having successfully installed 0.23.0 in a M chip MacOS, I'm getting this error:
import tree_sitter_python as tspython
from tree_sitter import Language, Parser, Point, Tree
PY_LANGUAGE = Language(tspython.language())
Error:
PY_LANGUAGE = Language(tspython.language())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: an integer is required
ERROR: an integer is required
Any clue why is this happening?
With a previous installation of this dependency using git protocol
I didn't get this error:
tree-sitter-python @ git+https://github.com/tree-sitter/tree-sitter-python@71778c2a472ed00a64abf4219544edbf8e4b86d7
@perseoGI #280 was opened on that issue. For some reason the issue is closed even though it has not been resolved yet.
@perseoGI #280 was opened on that issue. For some reason the issue is closed even though it has not been resolved yet.
Did you find a good approach to use python-tree-sitter with python grammar which does not involve using git protocol?
Unfortunately, no. I'm still waiting for all these bugs to get straightened out.
You need tree-sitter==0.23.0
@ObserverOfTime The bug persists in version 0.23.
It finally works in my setup using this tree-sitter related requirements:
lsp-tree-sitter==0.0.15
tree-sitter==0.23.0
tree-sitter-python==0.23.0
I had to adjust some query.matches
results due to some breaking change were introduced on the API in the latest tree-sitter relese.
Thank you!
Did you check the tree-sitter docs?
Is your feature request related to a problem? Please describe.
https://github.com/tree-sitter/py-tree-sitter says "Build from source" will be deprecated and in v0.22.0. However, on arm mac, running
pip install tree-sitter-python
reports "No matching distribution found for tree-sitter-python". I think there is no pre-built wheels for M chip mac.Describe the solution you'd like
Release the binary for the M chip mac.
Describe alternatives you've considered
/
Additional context
No response