Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: pre-compiled binary wheels for M chip macOS (arm64) #262

Open
1 task done
Co1lin opened this issue Mar 14, 2024 · 8 comments
Open
1 task done

feature: pre-compiled binary wheels for M chip macOS (arm64) #262

Co1lin opened this issue Mar 14, 2024 · 8 comments

Comments

@Co1lin
Copy link

Co1lin commented Mar 14, 2024

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

@ObserverOfTime
Copy link
Member

ObserverOfTime commented Apr 25, 2024

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.

@Gby56
Copy link

Gby56 commented May 22, 2024

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"}
]

@kiyoon
Copy link

kiyoon commented Jun 3, 2024

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'))

@tusharsadhwani
Copy link

@kiyoon for intel mac you should be able to pip install tree-sitter normally. Does that not work?

@kiyoon
Copy link

kiyoon commented Jun 3, 2024

@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.

@ObserverOfTime
Copy link
Member

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.

@kiyoon
Copy link

kiyoon commented Jun 3, 2024

I think it's my compiler because I had similar problem with rust. But I don't know how to fix it..

@kiyoon
Copy link

kiyoon commented Jun 4, 2024

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.

https://github.com/kiyoon/tree-sitter-python/releases

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

No branches or pull requests

5 participants