Skip to content

uv not detecting python in termux #7373

@ghost

Description

Disclaimer: I used AI to help write this report because English is not my first language, I apologize if anything is unclear or too detailed. Let me know if you need any clarifications

I'm encountering an issue when trying to use uv on Termux. When attempting to install packages using uv pip install, I receive an error indicating that no virtual environment or system Python installation is found, despite Python being installed and accessible.

Environment

  • OS: Termux (Android)
  • Python version: 3.11.9
  • UV version: 0.4.10
  • Termux version: 0.119.0-b1+monet36
  • Android version: 14
  • Device: vivo V2206
  • CPU architecture: aarch64
  • Kernel: Linux 4.19.157-perf+

Detailed Termux Information

Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__APK_FILE=/data/app/~~NkwmZsImblhcEj3x0C3ZBQ==/com.termux-9tzZyDv4vcJKhizjsUGNtQ==/base.apk
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__APP_VERSION_CODE=1020
TERMUX_APP__APP_VERSION_NAME=0.119.0-b1+monet36
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PID=31641
TERMUX_APP__TARGET_SDK=28
TERMUX_VERSION=0.119.0-b1+monet36
TERMUX__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c218,c258,c512,c768
TERMUX__SE_INFO=default:targetSdkVersion=28:complete
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c218,c258,c512,c768
TERMUX__UID=10730
TERMUX__USER_ID=0

LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so

Installed termux plugins:
com.termux.api versionCode:51

Steps to Reproduce

  1. Install uv on Termux
  2. Run uv pip install scapy
  3. Attempt to create a virtual environment using uv venv
  4. Try installing with --system flag: uv pip install scapy --system
  5. Create a virtual environment using python -m venv uvenv
  6. Activate the virtual environment and repeat steps 2-4

Expected Behavior

The package should install successfully, either in a virtual environment or system-wide.

Actual Behavior

Receive errors indicating that no virtual environment or system Python installation is found, despite Python being correctly installed and accessible.

Detailed Debug Output

Attempt 1: Installing scapy with UV (outside virtual environment)

~ $ uv -v pip install scapy
DEBUG uv 0.4.10
DEBUG Searching for Python interpreter in system path
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3: Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python: Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3.11: Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment

Attempt 2: Installing scapy with UV using --system flag

~ $ uv -v pip install scapy --system
DEBUG uv 0.4.10
DEBUG Searching for Python interpreter in system path
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3: Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python: Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3.11: Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
error: No system Python installation found

Attempt 3: Creating a virtual environment with UV

~ $ uv -v venv
DEBUG uv 0.4.10
DEBUG Searching for Python interpreter in managed installations or system path
DEBUG Searching for managed installations at `.local/share/uv/python`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3: Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python: Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3.11: Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
DEBUG Requested Python not found, checking for available download...
DEBUG Acquired lock for `.local/share/uv/python`
DEBUG Released lock at `/data/data/com.termux/files/home/.local/share/uv/python/.lock`
  × No interpreter found in managed installations or
  │ system path

Attempt 4: Installing scapy with UV (inside virtual environment)

(uvenv) ~ $ uv -v pip install scapy
DEBUG uv 0.4.10
DEBUG Searching for Python interpreter in system path
DEBUG Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/home/uvenv/bin/python3: Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/home/uvenv/bin/python3: Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/home/uvenv/bin/python: Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python`
DEBUG Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3.11`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/home/uvenv/bin/python3.11: Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3.11`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3: Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python: Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3.11: Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment

Attempt 5: Installing scapy with UV using --system flag (inside virtual environment)

(uvenv) ~ $ uv -v pip install scapy --system
DEBUG uv 0.4.10
DEBUG Searching for Python interpreter in system path
DEBUG Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/home/uvenv/bin/python3: Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/home/uvenv/bin/python: Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python`
DEBUG Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3.11`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/home/uvenv/bin/python3.11: Can't use Python at `/data/data/com.termux/files/home/uvenv/bin/python3.11`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3: Can't use Python at `/data/data/com.termux/files/usr/bin/python3`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python: Can't use Python at `/data/data/com.termux/files/usr/bin/python`
DEBUG Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
DEBUG Skipping bad interpreter at /data/data/com.termux/files/usr/bin/python3.11: Can't use Python at `/data/data/com.termux/files/usr/bin/python3.11`
error: No system Python installation found

Python and UV versions

(uvenv) ~ $ which python
/data/data/com.termux/files/home/uvenv/bin/python
(uvenv) ~ $ python --version
Python 3.11.9
(uvenv) ~ $ uv --version
uv 0.4.10

Additional Observations

  1. UV consistently fails to detect or use any Python installation, whether system-wide or in a virtual environment.
  2. The error messages suggest that UV is unable to use the Python interpreters it finds, but doesn't provide a specific reason why.
  3. The issue persists even after confirming that Python is correctly installed and accessible.
  4. Attempts to create a virtual environment with UV also fail due to the same interpreter detection issue.
  5. The problem occurs consistently across different scenarios and command variations, suggesting a fundamental issue with how UV interacts with the Python installation on Termux.

Attempted Solutions

  1. Upgraded Python:
    $ pkg upgrade python
    python is already the newest version (3.11.9-5).
    
  2. Tried both system-wide and virtual environment installations.
  3. Verified Python installation and accessibility.

Additional Notes

  • The issue occurs both in and out of a virtual environment.
  • Python is correctly installed and accessible, but UV seems unable to detect or use it.
  • Termux is using the apt package manager.
  • The Termux app is installed from GitHub (TERMUX_APP__APK_RELEASE=GITHUB).

Any assistance in resolving this issue would be greatly appreciated. Let me know if you need any additional information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguv pythonRelated to the uv python interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions