T
Termuxโ€ข2mo ago
NSPG911

Unable to install certain tree-sitter packages from pypi

if i try to install tree-sitter-markdown, tree-sitter-json, tree-sitter-toml, tree-sitter-yaml, tree-sitter-html, tree-sitter-rust, tree-sitter-xml or tree-sitter-java from pypi, it just fails (also is it possible to get python 3.13 on termux?)
63 Replies
owokitty
owokittyโ€ข2mo ago
in Termux, those packages are supposed to be installed from commands like pkg install tree-sitter-markdown , not pip install tree-sitter-markdown
NSPG911
NSPG911OPโ€ข2mo ago
how will it interface with python packages? i need it for textual[syntax]
owokitty
owokittyโ€ข2mo ago
@NSPG911 if you would like to have python 3.13, that is understandable, but it takes a very long time to update that in Termux. Here is the discussion page for that if you are interested in helping to do it. https://github.com/termux/termux-packages/pull/24679
owokitty
owokittyโ€ข2mo ago
I am planning to help do it in the future but only after I finish all of my other PRs that are currently open
NSPG911
NSPG911OPโ€ข2mo ago
i want to have python 3.13 because the thing im working on is locked to python >= 3.13
owokitty
owokittyโ€ข2mo ago
yes
NSPG911
NSPG911OPโ€ข2mo ago
but im fine to downgrade it if necessary, just need the tree sitter packages huh, the pr is closed
Biswa96
Biswa96โ€ข2mo ago
You didn't mention what errors you are seeing.
owokitty
owokittyโ€ข2mo ago
@NSPG911 does this work for you? this works for me
git clone https://github.com/tree-sitter-grammars/tree-sitter-markdown.git
cd tree-sitter-markdown
pip install .
git clone https://github.com/tree-sitter-grammars/tree-sitter-markdown.git
cd tree-sitter-markdown
pip install .
NSPG911
NSPG911OPโ€ข2mo ago
i prefer to use uv for my packages and stuff so not sure how i would install it into the project
owokitty
owokittyโ€ข2mo ago
ok great but keep in mind that pure-venvs often don't work in Termux so if it doesn't work you might need an unsandboxed-venv could you show me an example of the commands that you use to set up your project?
NSPG911
NSPG911OPโ€ข2mo ago
i remove the project.requires-python config from pyproject.toml then
rm uv.lock
rm .python-version
uv sync
rm uv.lock
rm .python-version
uv sync
owokitty
owokittyโ€ข2mo ago
error is this in pip install tree-sitter-markdown, does not happen when using pip install . on the git repository tree-sitter-markdown-inline/src/parser.c:3:10: fatal error: 'tree_sitter/parser.h' file not found
NSPG911
NSPG911OPโ€ข2mo ago
NSPG911
NSPG911OPโ€ข2mo ago
uv build . in the directory fails, pip install . works whats the difference?
owokitty
owokittyโ€ข2mo ago
does this work? I tried this
~/code/test $ uv sync
error: No `pyproject.toml` found in current directory or any parent directory
~/code/test $ uv init
Initialized project `test`
~/code/test $ uv sync
Using CPython 3.12.11 interpreter at: /data/data/com.termux/files/usr/bin/python3.12
Creating virtual environment at: .venv
Resolved 1 package in 23ms
Audited in 0.04ms
~/code/test $ uv pip install ~/code/tree-sitter-markdown/
Resolved 1 package in 19ms
Building tree-sitter-markdown @ file:///data/data/com.termux/files/home/co
โ ™ Preparing packages... (0/1) warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
If the cache and target directories are on different filesystems, hardlinking may not be supported.
Built tree-sitter-markdown @ file:///data/data/com.termux/files/home/co
Prepared 1 package in 1.96s
Installed 1 package in 21ms
+ tree-sitter-markdown==0.5.1 (from file:///data/data/com.termux/files/home/code/tree-sitter-markdown)
~/code/test $
~/code/test $ uv sync
error: No `pyproject.toml` found in current directory or any parent directory
~/code/test $ uv init
Initialized project `test`
~/code/test $ uv sync
Using CPython 3.12.11 interpreter at: /data/data/com.termux/files/usr/bin/python3.12
Creating virtual environment at: .venv
Resolved 1 package in 23ms
Audited in 0.04ms
~/code/test $ uv pip install ~/code/tree-sitter-markdown/
Resolved 1 package in 19ms
Building tree-sitter-markdown @ file:///data/data/com.termux/files/home/co
โ ™ Preparing packages... (0/1) warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
If the cache and target directories are on different filesystems, hardlinking may not be supported.
Built tree-sitter-markdown @ file:///data/data/com.termux/files/home/co
Prepared 1 package in 1.96s
Installed 1 package in 21ms
+ tree-sitter-markdown==0.5.1 (from file:///data/data/com.termux/files/home/code/tree-sitter-markdown)
~/code/test $
NSPG911
NSPG911OPโ€ข2mo ago
why does that work ๐Ÿ˜ญ so like do i have to do that for everything else??
owokitty
owokittyโ€ข2mo ago
here is more information about that: https://github.com/termux/termux-packages/issues/23567#issuecomment-2692983425 what I referred to as "unsandboxed-venv", or what I mean by that, is the command "python3 -m venv myenv --system-site-packages" probably but it's possible for us to make python-tree-sitter-X packages for all of them by copying the way they are provided on Arch Linux AUR, but it can take a while to set up that https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-tree-sitter-markdown
NSPG911
NSPG911OPโ€ข2mo ago
oh thats interesting, never used that before should i proot-distro to archlinux?
owokitty
owokittyโ€ข2mo ago
if you would like to then you can yes, and arch linux has python 3.13 and normal venvs work there
NSPG911
NSPG911OPโ€ข2mo ago
is there any major differences between ubuntu (im assuming thats what termux uses) and arch, aside from apt and pacman? i also have an issue with arch, it says Warning: CPU doesn't support 32-but instructions, some software may not work.
owokitty
owokittyโ€ข2mo ago
actually the only thing that is really similar between ubuntu and termux is that they both use apt, everything else is more different from ubuntu than ubuntu is from arch linux
NSPG911
NSPG911OPโ€ข2mo ago
oh
owokitty
owokittyโ€ข2mo ago
if you compare them both to termux, then there actually aren't very many major differences between ubuntu and arch linux other than the package versions, the default settings of some things, the package manager, the preinstalled packages, and a bunch of other stuff that is actually less important than it seems when you compare both of them to Termux, which is significantly different from them on a deeper level
NSPG911
NSPG911OPโ€ข2mo ago
anyways so this wont be open again?
owokitty
owokittyโ€ข2mo ago
interesting, i have an 64-bit-ARM-only computer also where I am running Ubuntu and Termux, and I ran Arch Linux in a VM on it for a little while (and the VM would have also been affected by the 64-bit-only-ness), but I don't remember ever seeing that message yet
NSPG911
NSPG911OPโ€ข2mo ago
im on a oneplus 13r
owokitty
owokittyโ€ข2mo ago
no it will be reopened when someone is ready to finish it, the person who opened it closed it because they aren't ready to finish it yet but anyone else can reopen it and finish it also you can too if you know how to do it but it's very hard
NSPG911
NSPG911OPโ€ข2mo ago
oh im not at all interested in continuing it ๐Ÿ˜… no clue about android app development in general
owokitty
owokittyโ€ข2mo ago
if you try arch linux in proot-distro and it says the same message again then let me know where you saw it and what command makes that message, and I can try it on my computer that is also 64 bit only and check if the same thing happens to me or not wait I realized I can install the arch linux termux proot-distro on that computer right now too, I can follow along what you do and see if it happens to me from the exact thing you do, if you want
NSPG911
NSPG911OPโ€ข2mo ago
pd install archlinux
pd login archlinux
pd install archlinux
pd login archlinux
owokitty
owokittyโ€ข2mo ago
wow, thanks, I see the same message on my 64-bit only computer it comes from proot-distro itself, https://github.com/termux/proot-distro/blob/8f68053e346ee92219d325fa6d43e92922502a2e/proot-distro.sh#L689 arch linux ARM aarch64 is completely 64-bit I think, so I think it is just a warning and you are unlikely to see any real error from it
NSPG911
NSPG911OPโ€ข2mo ago
okay, so how hard would that be should i just mark https://discord.com/channels/641256914684084234/1423158072683008070/1423200143376777277 as the solution?
owokitty
owokittyโ€ข2mo ago
you can if that is a good enough solution for you, but if you need better solutions then leave this open
NSPG911
NSPG911OPโ€ข2mo ago
ah okay, hope that the tree sitter packages get added should i open an issue in any of the repositories?
owokitty
owokittyโ€ข2mo ago
yes you can, in here, open a package request repository and post a link to the AUR package, and list all the packages you need that would be good and help us keep track of the package request https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-tree-sitter-markdown
NSPG911
NSPG911OPโ€ข2mo ago
in where?
owokitty
owokittyโ€ข2mo ago
GitHub
termux/termux-packages
A package build system for Termux. Contribute to termux/termux-packages development by creating an account on GitHub.
NSPG911
NSPG911OPโ€ข2mo ago
im kinda confused on tree sitter markdown though i have it installed
(rovr) ~/rovr> pkg search tree-sitter-markdown
Checking availability of current mirror:
[*] https://mirror.nyist.edu.cn/termux/apt/termux-main: ok
Sorting... Done
Full Text Search... Done
tree-sitter-markdown/stable,now 0.5.1 aarch64 [installed,automatic]
Markdown grammar for tree-sitter
(rovr) ~/rovr> pkg search tree-sitter-markdown
Checking availability of current mirror:
[*] https://mirror.nyist.edu.cn/termux/apt/termux-main: ok
Sorting... Done
Full Text Search... Done
tree-sitter-markdown/stable,now 0.5.1 aarch64 [installed,automatic]
Markdown grammar for tree-sitter
but uv cannot use it, even though pip can uv still generates the insanely large log, but python -m pip gives this
(rovr) ~/rovr> python -m pip install tree-sitter-markdown
Requirement already satisfied: tree-sitter-markdown in /data/data/com.termux/files/usr/lib/python3.12/site-packages (0.5.1)
(rovr) ~/rovr> python -m pip install tree-sitter-markdown
Requirement already satisfied: tree-sitter-markdown in /data/data/com.termux/files/usr/lib/python3.12/site-packages (0.5.1)
nu is using a venv overlay provided by uv
(rovr) ~/rovr> which python | select path
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ # โ”‚ path โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0 โ”‚ /data/data/com.termux/files/home/rovr/.venv/bin/python โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
(rovr) ~/rovr> which python | select path
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ # โ”‚ path โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0 โ”‚ /data/data/com.termux/files/home/rovr/.venv/bin/python โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
owokitty
owokittyโ€ข2mo ago
did you use the commands I sent here exactly, including uv pip install ~/code/tree-sitter-markdown/, but with the path to where you downloaded tree-sitter-markdown instead of my path, or did you do something else? ^
NSPG911
NSPG911OPโ€ข2mo ago
the issue with that method is that uv sync will remove it right?
owokitty
owokittyโ€ข2mo ago
oh, does it? I didn't know
NSPG911
NSPG911OPโ€ข2mo ago
uv sync ensures your pyproject.toml is consistent with the venv
owokitty
owokittyโ€ข2mo ago
in that case, actually having pkg install python-tree-sitter-markdown available wouldn't help your problem by itself either, you need to find a way to get uv to allow the "unsandboxed venv" that i mentioned here i don't know right now if there is a way to get uv's venv to do that but there might be
NSPG911
NSPG911OPโ€ข2mo ago
i did use uv venv --system-site-packages, but it doesnt show up if i use python -m venv, there isnt a venv activation for nushell
owokitty
owokittyโ€ข2mo ago
oh i see, unfortunately I am not familiar with nushell, so I don't really know what to do if that happens, there is a discussion here about that,
owokitty
owokittyโ€ข2mo ago
GitHub
A nushell wrapper for virtualenv ยท Issue #273 ยท nushell/nu_sc...
Hi everyone ๐Ÿ‘‹ ๐Ÿ˜‹ i've been using virtualenv to manage python virtual environments for a long time, with projects such as virtualenvwrapper on bash or virtualfish on fish ๐Ÿ˜‹ i could not find anyth...
owokitty
owokittyโ€ข2mo ago
but I don't really understand what they are talking about in that thread or where to get the solution that it was closed as completed for
NSPG911
NSPG911OPโ€ข2mo ago
and the repo which was linked got obliterated https://github.com/amtoine/virtnualenv
NSPG911
NSPG911OPโ€ข2mo ago
Commands | uv
uv is an extremely fast Python package and project manager, written in Rust.
owokitty
owokittyโ€ข2mo ago
so uv still tries to build python tree-sitter-markdown even though you used --no-build-isolation? strange
NSPG911
NSPG911OPโ€ข2mo ago
oh wait i didnt use that lemme try again still breaks
owokitty
owokittyโ€ข2mo ago
it makes it seem like uv isn't respecting --no-build-isolation the way that regular venvs do would you be able to show the code of the project you are trying to build? i could try it without uv to check what happens then
NSPG911
NSPG911OPโ€ข2mo ago
yeah it still gives me the same error even though im using a --system-site-packages venv and installing with --no-build-isolation
NSPG911
NSPG911OPโ€ข2mo ago
GitHub
GitHub - NSPC911/rovr: A post-modern terminal file manager.
A post-modern terminal file manager. Contribute to NSPC911/rovr development by creating an account on GitHub.
NSPG911
NSPG911OPโ€ข2mo ago
you might need to downgrade it, it uses python3.13, so i just remove uv.lock and .python-version and change pyproject.toml to use >=3.12
owokitty
owokittyโ€ข2mo ago
ok i changed pyproject.toml to have python 3.12 instead of 3.13, yeah, now when I use pip install . on your project, it shows this: Requirement already satisfied: tree-sitter-markdown>=0.3.0 in /data/data/com.termux/files/usr/lib/python3.12/site-packages (from textual[syntax]<7.0.0,>=6.0.0->rovr==0.3.0) (0.5.1) and it does fail to build the other ones that aren't the markdown one that it still needs, but i would guess the manual install method for the rest of them might also work for me
NSPG911
NSPG911OPโ€ข2mo ago
uv handles it differently than pip
owokitty
owokittyโ€ข2mo ago
yeah
NSPG911
NSPG911OPโ€ข2mo ago
very weird might need to check for an open issue
owokitty
owokittyโ€ข2mo ago
you should open an issue for this in termux-packages also, by showing that uv in termux installs differently from pip in termux, i did not create the termux uv package but someone else might know what to do in uv but it is related to your issue about the python-tree-sitter-markdown, so you can put the explanation of this in the same issue where you requested those packages, if you want, because, even if we add those packages for pkg install,, they won't work for your use case of uv until there is a way to get uv to find them in the folder /data/data/com.termux/files/usr/lib/python3.12/site-packages
NSPG911
NSPG911OPโ€ข2mo ago
GitHub
uv does not use system site packages like tree-sitter-* ยท Issue ...
Summary On termux, the mirror does not provide some tree-sitter packages, but one of it that it provides is tree-sitter-markdown. Attempting to install it via pip is successful ~/test $ python -m v...
owokitty
owokittyโ€ข2mo ago
good, I did not anticipate you might report it upstream but that's probably fine I just added some of the commands from this discord thread that are part of the reproduction steps that you didn't add there, since I assumed you might have just forgotten to add them

Did you find this page helpful?