textual: Failed to install in Termux (Android)

Have you checked closed issues?

Yes

Have you checked against the most recent version of Textual?

Yes

The bug

Fail to install textual-demo:

uvx --python 3.12 textual-demo

Output:

   Building tree-sitter-bash==0.23.3
   Building tree-sitter-rust==0.23.2
   Building tree-sitter-markdown==0.3.2
   Building tree-sitter==0.24.0
   Building tree-sitter-python==0.23.6
   Building tree-sitter-sql==0.3.7
   Building tree-sitter-java==0.23.5
   Building tree-sitter-javascript==0.23.1
   Building tree-sitter-go==0.23.4
      Built tree-sitter==0.24.0
  × Failed to build `tree-sitter-regex==0.24.3`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_wheel`
      failed (exit status: 1)

      [stdout]
      running bdist_wheel
      running build
      running build_py
      copying
      bindings/python/tree_sitter_regex/__init__.py
      ->
      build/lib.linux-aarch64-cpython-312/tree_sitter_regex
      running egg_info
      writing
      bindings/python/tree_sitter_regex.egg-info/PKG-INFO
      writing dependency_links to
      bindings/python/tree_sitter_regex.egg-info/dependency_links.txt
      writing requirements to
      bindings/python/tree_sitter_regex.egg-info/requires.txt
      writing top-level names to
      bindings/python/tree_sitter_regex.egg-info/top_level.txt
      reading manifest file
      'bindings/python/tree_sitter_regex.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file
      'bindings/python/tree_sitter_regex.egg-info/SOURCES.txt'
      copying
      bindings/python/tree_sitter_regex/__init__.pyi
      ->
      build/lib.linux-aarch64-cpython-312/tree_sitter_regex
      copying
      bindings/python/tree_sitter_regex/binding.c ->
      build/lib.linux-aarch64-cpython-312/tree_sitter_regex
      copying
      bindings/python/tree_sitter_regex/py.typed ->
      build/lib.linux-aarch64-cpython-312/tree_sitter_regex
      running build_ext
      building '_binding' extension
      aarch64-linux-android-clang
      -fno-strict-overflow -Wsign-compare
      -Wunreachable-code -DNDEBUG -g
      -O3 -Wall -fstack-protector-strong
      -O3 -fstack-protector-strong -O3
      -fPIC -DPy_LIMITED_API=0x03090000
      -DPY_SSIZE_T_CLEAN
      -DTREE_SITTER_HIDE_SYMBOLS -Isrc
      -I/data/data/com.termux/files/home/.cache/uv/builds-v0/.tmpjazNwd/include
      -I/data/data/com.termux/files/usr/include/python3.12
      -c
      bindings/python/tree_sitter_regex/binding.c -o
      build/temp.linux-aarch64-cpython-312/bindings/python/tree_sitter_regex/binding.o
      -std=c11 -fvisibility=hidden
      aarch64-linux-android-clang
      -fno-strict-overflow -Wsign-compare
      -Wunreachable-code -DNDEBUG -g
      -O3 -Wall -fstack-protector-strong
      -O3 -fstack-protector-strong -O3
      -fPIC -DPy_LIMITED_API=0x03090000
      -DPY_SSIZE_T_CLEAN
      -DTREE_SITTER_HIDE_SYMBOLS -Isrc
      -I/data/data/com.termux/files/home/.cache/uv/builds-v0/.tmpjazNwd/include
      -I/data/data/com.termux/files/usr/include/python3.12
      -c src/parser.c -o
      build/temp.linux-aarch64-cpython-312/src/parser.o
      -std=c11 -fvisibility=hidden

      [stderr]
      src/parser.c:1:10: fatal error:
      'tree_sitter/parser.h' file not found
          1 | #include "tree_sitter/parser.h"
            |          ^~~~~~~~~~~~~~~~~~~~~~
      1 error generated.
      error: command
      '/data/data/com.termux/files/usr/bin/aarch64-linux-android-clang'
      failed with exit code 1

      hint: This error likely indicates that
      you need to install a library that
      provides "tree_sitter/parser.h" for
      `tree-sitter-regex@0.24.3`
  help: `tree-sitter-regex` (v0.24.3) was included
        because `textual-demo` (v1.0.3) depends on
        `textual[syntax]` (v2.1.2) which depends on
        `tree-sitter-regex`

I came here because Parllama use textual, and I get same failed install.

Termux has some tree-sitter packages, but not all from output log.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Same issue happens with aider-chat. downloading the tree sitter c static package may fix it but the problem is you cant install it because of conflicting dependency versions

After reading up on uv, there might be a workaround using uv’s concept of dependency overrides as a last resort.

Could you try this and see if the install works?

uvx --override overrides.txt textual-demo

Contents of overrides.txt:

tree-sitter; sys_platform == 'never'
tree-sitter-python; sys_platform == 'never'
tree-sitter-markdown; sys_platform == 'never'
tree-sitter-json; sys_platform == 'never'
tree-sitter-toml; sys_platform == 'never'
tree-sitter-yaml; sys_platform == 'never'
tree-sitter-html; sys_platform == 'never'
tree-sitter-css; sys_platform == 'never'
tree-sitter-javascript; sys_platform == 'never'
tree-sitter-rust; sys_platform == 'never'
tree-sitter-go; sys_platform == 'never'
tree-sitter-regex; sys_platform == 'never'
tree-sitter-xml; sys_platform == 'never'
tree-sitter-sql; sys_platform == 'never'
tree-sitter-java; sys_platform == 'never'
tree-sitter-bash; sys_platform == 'never'

The core Textual library should have no problem installing on Android. The issue is the extra dependencies for syntax highlighting:

These [tree-sitter] packages are distributed as binary wheels, so it may limit your applications ability to run in environments where these wheels are not available.

I’m afraid I don’t know anything about Android to suggest any workarounds.