pypa / virtualenv

Virtual Python Environment builder
https://virtualenv.pypa.io
MIT License
4.83k stars 1.03k forks source link

PermissionError: [Errno 13] Permission denied: '/system_ext/bin' #2794

Open mgedmin opened 3 weeks ago

mgedmin commented 3 weeks ago

Issue

I'm trying to do some Python development on an Android phone. I pkg install python pipx, I pipx install tox, and when I run tox, I get this traceback from inside virtualenv's Python interpreter discovery code:

$ tox
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/bin/tox", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 20, in run
    result = main(sys.argv[1:] if args is None else args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 46, in main
    return handler(state)
           ^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/legacy.py", line 115, in legacy
    return run_sequential(state)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/sequential.py", line 25, in run_sequential
    return execute(state, max_workers=1, has_spinner=False, live=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/common.py", line 167, in execute
    state.envs.ensure_only_run_env_is_active()
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 436, in ensure_only_run_env_is_active
    envs, active = self._defined_envs, self._env_name_to_active()
                   ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 291, in _defined_envs
    raise failed[next(iter(failed_to_create))]
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 268, in _defined_envs
    run_env.package_env = self._build_pkg_env(pkg_name_type, name, env_name_to_active)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 340, in _build_pkg_env
    name_type = next(child_package_envs)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/package/pyproject.py", line 191, in register_run_env
    yield from super().register_run_env(run_env)
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 117, in register_run_env
    pkg_env = run_env.conf["wheel_build_env"]
              ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 116, in __getitem__
    return self.load(item)
           ^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 127, in load
    return config_definition.__call__(self._conf, self.loaders, ConfigLoadArgs(chain, self.name, self.env_name))  # noqa: PLC2801
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/of_type.py", line 117, in __call__
    value = self.default(conf, args.env_name) if callable(self.default) else self.default
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 93, in default_wheel_tag
    run_py = cast(Python, run_env).base_python
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/api.py", line 282, in base_python
    self._base_python = self._get_python(base_pythons)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 139, in _get_python
    interpreter = self.creator.interpreter
                  ^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 131, in creator
    return self.session.creator
           ^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 112, in session
    self._virtualenv_session = session_via_cli(env_dir, options=None, setup_logging=False, env=env)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 49, in session_via_cli
    parser, elements = build_parser(args, options, setup_logging, env)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 77, in build_parser
    parser._interpreter = interpreter = discover.interpreter  # noqa: SLF001
                                        ^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/discover.py", line 41, in interpreter
    self._interpreter = self.run()
                        ^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 59, in run
    result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 76, in get_interpreter
    for interpreter, impl_must_match in propose_interpreters(spec, try_first_with, app_data, env):
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 150, in propose_interpreters
    for exe, impl_must_match in find_candidates(path):
                                ^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 210, in path_exes
    for exe in path.iterdir():
               ^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/pathlib.py", line 1056, in iterdir
    for name in os.listdir(self):
                ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/system_ext/bin'

(I originally filed this as a tox bug, but, well, the crashing code is virtualenv's.

Environment

Provide at least:

Output of the virtual environment creation

This is difficult, as when I run virtualenv myself, it works fine. When pipx runs virtualenv, it works fine. When tox runs virtualenv, it crashes -- and I've no idea how to ask tox to please run virtualenv with -vvv --with-traceback.

Well, there is a traceback at least. And the cause is pretty obvious: my $PATH contains a directory that is not accessible to the user running virtualenv.

My $PATH is

$ echo $PATH | tr : '\n'
/data/data/com.termux/files/home/bin
/data/data/com.termux/files/home/bin/local
/data/data/com.termux/files/home/.local/bin
/usr/games
/usr/local/sbin
/usr/local/bin
/usr/sbin
/sbin
/data/data/com.termux/files/usr/bin
/product/bin
/apex/com.android.runtime/bin
/apex/com.android.art/bin
/system_ext/bin
/system/bin
/system/xbin
/odm/bin
/vendor/bin
/vendor/xbin
$ ls -ld /system_ext/bin
drwxr-x--x. 3 root shell 4096 Jan  1  2009 /system_ext/bin

I have no idea why Termux puts an inaccessible directory on the default PATH, but it would be helpful if virtualenv's interpreter discovery would skip it instead of failing entirely.

(I have another Android device - a Nokia N20 tablet with Android 13. Tox and virtualenv work fine on it in Termux 0.118.0. The default $PATH is shorter and doesn't mention /system_ext)

gaborbernat commented 3 weeks ago

Run tox with -vvvv 👍

mgedmin commented 3 weeks ago

tox -vvvv:

```console ROOT: 17181 D setup logging to NOTSET on pid 31562 [tox/report.py:222] .pkg: 17668 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73] .pkg: 17671 D filesystem is case-sensitive [virtualenv/info.py:25] .pkg: 17680 D got python info of %s from (PosixPath('/data/data/com.termux/files/usr/bin/python3.12'), PosixPath('/data/data/com.termux/files/home/.local/share/virtualenv/py_info/1/b79a9a5477d361435df197a745d21ec01f512605a327ac6a32dfd7a0672634c1.json')) [virtualenv/app_data/via_disk_folder.py:131] .pkg: 17682 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80] .pkg: 17683 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82] .pkg: 17902 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73] .pkg: 17903 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80] .pkg: 17904 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82] .pkg: 17915 I find interpreter for spec PythonSpec(major=3, minor=12) [virtualenv/discovery/builtin.py:73] .pkg: 17915 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80] .pkg: 17916 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82] .pkg: 17924 I find interpreter for spec PythonSpec(major=3, minor=13) [virtualenv/discovery/builtin.py:73] .pkg: 17925 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80] .pkg: 17926 D discover PATH[0]=/data/data/com.termux/files/home/bin [virtualenv/discovery/builtin.py:149] .pkg: 17942 D get interpreter info via cmd: /data/data/com.termux/files/home/bin/python3.13 /data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/py_info.py aBxXf0JanR8JjE7BvE58Efzk7fcYWNP4 SZ1xu1jiNwx72d1H4UqG8geUi2nnnYwH [virtualenv/discovery/cached_py_info.py:112] .pkg: 17968 I failed to query /data/data/com.termux/files/home/bin/python3.13 with code 1 out: 'python3.13 not installed, try\n\n rebuild-python --branch=3.13 --pull --clean\n' [virtualenv/discovery/cached_py_info.py:34] .pkg: 17969 D discover PATH[1]=/data/data/com.termux/files/home/bin/local [virtualenv/discovery/builtin.py:149] .pkg: 17969 D discover PATH[2]=/data/data/com.termux/files/home/.local/bin [virtualenv/discovery/builtin.py:149] .pkg: 17969 D discover PATH[3]=/data/data/com.termux/files/usr/bin [virtualenv/discovery/builtin.py:149] .pkg: 17975 D got python info of %s from (PosixPath('/data/data/com.termux/files/usr/bin/python3'), PosixPath('/data/data/com.termux/files/home/.local/share/virtualenv/py_info/1/dc9930c17e9cd9135e54e5b33ca6344ea5ed0954bc7fe787d0822891c3159b6d.json')) [virtualenv/app_data/via_disk_folder.py:131] .pkg: 17976 I proposed PathPythonInfo(spec=CPython3.12.7.final.0-64, exe=/data/data/com.termux/files/usr/bin/python3, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80] .pkg: 17977 D discover PATH[4]=/apex/com.android.runtime/bin [virtualenv/discovery/builtin.py:149] .pkg: 17978 D discover PATH[5]=/apex/com.android.art/bin [virtualenv/discovery/builtin.py:149] .pkg: 17978 D discover PATH[6]=/system_ext/bin [virtualenv/discovery/builtin.py:149] .pkg: 17990 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73] .pkg: 17990 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80] .pkg: 17991 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82] .pkg: 17998 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73] .pkg: 17998 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80] .pkg: 17999 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82] Traceback (most recent call last): File "/data/data/com.termux/files/home/.local/bin/tox", line 8, in sys.exit(run()) ^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 20, in run result = main(sys.argv[1:] if args is None else args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 46, in main return handler(state) ^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/legacy.py", line 115, in legacy return run_sequential(state) ^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/sequential.py", line 25, in run_sequential return execute(state, max_workers=1, has_spinner=False, live=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/common.py", line 167, in execute state.envs.ensure_only_run_env_is_active() File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 436, in ensure_only_run_env_is_active envs, active = self._defined_envs, self._env_name_to_active() ^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 291, in _defined_envs raise failed[next(iter(failed_to_create))] File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 268, in _defined_envs run_env.package_env = self._build_pkg_env(pkg_name_type, name, env_name_to_active) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 340, in _build_pkg_env name_type = next(child_package_envs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/package/pyproject.py", line 191, in register_run_env yield from super().register_run_env(run_env) File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 117, in register_run_env pkg_env = run_env.conf["wheel_build_env"] ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 116, in __getitem__ return self.load(item) ^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 127, in load return config_definition.__call__(self._conf, self.loaders, ConfigLoadArgs(chain, self.name, self.env_name)) # noqa: PLC2801 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/of_type.py", line 117, in __call__ value = self.default(conf, args.env_name) if callable(self.default) else self.default ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 93, in default_wheel_tag run_py = cast(Python, run_env).base_python ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/api.py", line 282, in base_python self._base_python = self._get_python(base_pythons) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 139, in _get_python interpreter = self.creator.interpreter ^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 131, in creator return self.session.creator ^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 112, in session self._virtualenv_session = session_via_cli(env_dir, options=None, setup_logging=False, env=env) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 49, in session_via_cli parser, elements = build_parser(args, options, setup_logging, env) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 77, in build_parser parser._interpreter = interpreter = discover.interpreter # noqa: SLF001 ^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/discover.py", line 41, in interpreter self._interpreter = self.run() ^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 59, in run result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 76, in get_interpreter for interpreter, impl_must_match in propose_interpreters(spec, try_first_with, app_data, env): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 150, in propose_interpreters for exe, impl_must_match in find_candidates(path): ^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 210, in path_exes for exe in path.iterdir(): ^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/pathlib.py", line 1056, in iterdir for name in os.listdir(self): ^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied: '/system_ext/bin ```
a404050aaa commented 3 weeks ago

Issue

I'm trying to do some Python development on an Android phone. I pkg install python pipx, I pipx install tox, and when I run tox, I get this traceback from inside virtualenv's Python interpreter discovery code:

$ tox
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/bin/tox", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 20, in run
    result = main(sys.argv[1:] if args is None else args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 46, in main
    return handler(state)
           ^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/legacy.py", line 115, in legacy
    return run_sequential(state)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/sequential.py", line 25, in run_sequential
    return execute(state, max_workers=1, has_spinner=False, live=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/common.py", line 167, in execute
    state.envs.ensure_only_run_env_is_active()
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 436, in ensure_only_run_env_is_active
    envs, active = self._defined_envs, self._env_name_to_active()
                   ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 291, in _defined_envs
    raise failed[next(iter(failed_to_create))]
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 268, in _defined_envs
    run_env.package_env = self._build_pkg_env(pkg_name_type, name, env_name_to_active)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 340, in _build_pkg_env
    name_type = next(child_package_envs)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/package/pyproject.py", line 191, in register_run_env
    yield from super().register_run_env(run_env)
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 117, in register_run_env
    pkg_env = run_env.conf["wheel_build_env"]
              ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 116, in __getitem__
    return self.load(item)
           ^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 127, in load
    return config_definition.__call__(self._conf, self.loaders, ConfigLoadArgs(chain, self.name, self.env_name))  # noqa: PLC2801
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/of_type.py", line 117, in __call__
    value = self.default(conf, args.env_name) if callable(self.default) else self.default
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 93, in default_wheel_tag
    run_py = cast(Python, run_env).base_python
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/api.py", line 282, in base_python
    self._base_python = self._get_python(base_pythons)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 139, in _get_python
    interpreter = self.creator.interpreter
                  ^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 131, in creator
    return self.session.creator
           ^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 112, in session
    self._virtualenv_session = session_via_cli(env_dir, options=None, setup_logging=False, env=env)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 49, in session_via_cli
    parser, elements = build_parser(args, options, setup_logging, env)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 77, in build_parser
    parser._interpreter = interpreter = discover.interpreter  # noqa: SLF001
                                        ^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/discover.py", line 41, in interpreter
    self._interpreter = self.run()
                        ^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 59, in run
    result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 76, in get_interpreter
    for interpreter, impl_must_match in propose_interpreters(spec, try_first_with, app_data, env):
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 150, in propose_interpreters
    for exe, impl_must_match in find_candidates(path):
                                ^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 210, in path_exes
    for exe in path.iterdir():
               ^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/pathlib.py", line 1056, in iterdir
    for name in os.listdir(self):
                ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/system_ext/bin'

(I originally filed this as a tox bug, but, well, the crashing code is virtualenv's.

Environment

Provide at least:

  • OS: Android 14, Termux version "googleplay.2024.10.30".
  • pip list of the host python where virtualenv is installed:

$ pipx runpip tox list Package Version

cachetools 5.5.0 chardet 5.2.0 colorama 0.4.6 distlib 0.3.9 filelock 3.16.1 packaging 24.1 pip 24.3.1 platformdirs 4.3.6 pluggy 1.5.0 pyproject-api 1.8.0 tox 4.23.2 virtualenv 20.27.


**Output of the virtual environment creation**

This is difficult, as when I run virtualenv myself, it works fine.  When pipx runs virtualenv, it works fine.  When *tox* runs virtualenv, it crashes -- and I've no idea how to ask tox to please run virtualenv with `-vvv --with-traceback`.

Well, there is a traceback at least.  And the cause is pretty obvious: my $PATH contains a directory that is not accessible to the user running virtualenv.

My $PATH is

```console
$ echo $PATH | tr : '\n'
/data/data/com.termux/files/home/bin
/data/data/com.termux/files/home/bin/local
/data/data/com.termux/files/home/.local/bin
/usr/games
/usr/local/sbin
/usr/local/bin
/usr/sbin
/sbin
/data/data/com.termux/files/usr/bin
/product/bin
/apex/com.android.runtime/bin
/apex/com.android.art/bin
/system_ext/bin
/system/bin
/system/xbin
/odm/bin
/vendor/bin
/vendor/xbin
$ ls -ld /system_ext/bin
drwxr-x--x. 3 root shell 4096 Jan  1  2009 /system_ext/bin

I have no idea why Termux puts an inaccessible directory on the default PATH, but it would be helpful if virtualenv's interpreter discovery would skip it instead of failing entirely.

(I have another Android device - a Nokia N20 tablet with Android 13. Tox and virtualenv work fine on it in Termux 0.118.0. The default $PATH is shorter and doesn't mention /system_ext)

tox -vvvv:

ROOT: 17181 D setup logging to NOTSET on pid 31562 [tox/report.py:222]
.pkg: 17668 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73]
.pkg: 17671 D filesystem is case-sensitive [virtualenv/info.py:25]
.pkg: 17680 D got python info of %s from (PosixPath('/data/data/com.termux/files/usr/bin/python3.12'), PosixPath('/data/data/com.termux/files/home/.local/share/virtualenv/py_info/1/b79a9a5477d361435df197a745d21ec01f512605a327ac6a32dfd7a0672634c1.json')) [virtualenv/app_data/via_disk_folder.py:131]
.pkg: 17682 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80]
.pkg: 17683 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82]
.pkg: 17902 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73]
.pkg: 17903 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80]
.pkg: 17904 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82]
.pkg: 17915 I find interpreter for spec PythonSpec(major=3, minor=12) [virtualenv/discovery/builtin.py:73]
.pkg: 17915 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80]
.pkg: 17916 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82]
.pkg: 17924 I find interpreter for spec PythonSpec(major=3, minor=13) [virtualenv/discovery/builtin.py:73]
.pkg: 17925 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80]
.pkg: 17926 D discover PATH[0]=/data/data/com.termux/files/home/bin [virtualenv/discovery/builtin.py:149]
.pkg: 17942 D get interpreter info via cmd: /data/data/com.termux/files/home/bin/python3.13 /data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/py_info.py aBxXf0JanR8JjE7BvE58Efzk7fcYWNP4 SZ1xu1jiNwx72d1H4UqG8geUi2nnnYwH [virtualenv/discovery/cached_py_info.py:112]
.pkg: 17968 I failed to query /data/data/com.termux/files/home/bin/python3.13 with code 1 out: 'python3.13 not installed, try\n\n  rebuild-python --branch=3.13 --pull --clean\n' [virtualenv/discovery/cached_py_info.py:34]
.pkg: 17969 D discover PATH[1]=/data/data/com.termux/files/home/bin/local [virtualenv/discovery/builtin.py:149]
.pkg: 17969 D discover PATH[2]=/data/data/com.termux/files/home/.local/bin [virtualenv/discovery/builtin.py:149]
.pkg: 17969 D discover PATH[3]=/data/data/com.termux/files/usr/bin [virtualenv/discovery/builtin.py:149]
.pkg: 17975 D got python info of %s from (PosixPath('/data/data/com.termux/files/usr/bin/python3'), PosixPath('/data/data/com.termux/files/home/.local/share/virtualenv/py_info/1/dc9930c17e9cd9135e54e5b33ca6344ea5ed0954bc7fe787d0822891c3159b6d.json')) [virtualenv/app_data/via_disk_folder.py:131]
.pkg: 17976 I proposed PathPythonInfo(spec=CPython3.12.7.final.0-64, exe=/data/data/com.termux/files/usr/bin/python3, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80]
.pkg: 17977 D discover PATH[4]=/apex/com.android.runtime/bin [virtualenv/discovery/builtin.py:149]
.pkg: 17978 D discover PATH[5]=/apex/com.android.art/bin [virtualenv/discovery/builtin.py:149]
.pkg: 17978 D discover PATH[6]=/system_ext/bin [virtualenv/discovery/builtin.py:149]
.pkg: 17990 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73]
.pkg: 17990 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80]
.pkg: 17991 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82]
.pkg: 17998 I find interpreter for spec PythonSpec(path=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:73]
.pkg: 17998 I proposed PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:80]
.pkg: 17999 D accepted PythonInfo(spec=CPython3.12.7.final.0-64, system=/data/data/com.termux/files/usr/bin/python3.12, exe=/data/data/com.termux/files/home/.local/pipx/venvs/tox/bin/python, platform=linux, version='3.12.7 (main, Oct 23 2024, 22:38:17) [Clang 18.0.2 (https://android.googlesource.com/toolchain/llvm-project d8003a456', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:82]
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/bin/tox", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 20, in run
    result = main(sys.argv[1:] if args is None else args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 46, in main
    return handler(state)
           ^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/legacy.py", line 115, in legacy
    return run_sequential(state)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/sequential.py", line 25, in run_sequential
    return execute(state, max_workers=1, has_spinner=False, live=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/cmd/run/common.py", line 167, in execute
    state.envs.ensure_only_run_env_is_active()
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 436, in ensure_only_run_env_is_active
    envs, active = self._defined_envs, self._env_name_to_active()
                   ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 291, in _defined_envs
    raise failed[next(iter(failed_to_create))]
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 268, in _defined_envs
    run_env.package_env = self._build_pkg_env(pkg_name_type, name, env_name_to_active)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/session/env_select.py", line 340, in _build_pkg_env
    name_type = next(child_package_envs)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/package/pyproject.py", line 191, in register_run_env
    yield from super().register_run_env(run_env)
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 117, in register_run_env
    pkg_env = run_env.conf["wheel_build_env"]
              ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 116, in __getitem__
    return self.load(item)
           ^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/sets.py", line 127, in load
    return config_definition.__call__(self._conf, self.loaders, ConfigLoadArgs(chain, self.name, self.env_name))  # noqa: PLC2801
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/config/of_type.py", line 117, in __call__
    value = self.default(conf, args.env_name) if callable(self.default) else self.default
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 93, in default_wheel_tag
    run_py = cast(Python, run_env).base_python
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/api.py", line 282, in base_python
    self._base_python = self._get_python(base_pythons)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 139, in _get_python
    interpreter = self.creator.interpreter
                  ^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 131, in creator
    return self.session.creator
           ^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 112, in session
    self._virtualenv_session = session_via_cli(env_dir, options=None, setup_logging=False, env=env)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 49, in session_via_cli
    parser, elements = build_parser(args, options, setup_logging, env)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 77, in build_parser
    parser._interpreter = interpreter = discover.interpreter  # noqa: SLF001
                                        ^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/discover.py", line 41, in interpreter
    self._interpreter = self.run()
                        ^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 59, in run
    result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 76, in get_interpreter
    for interpreter, impl_must_match in propose_interpreters(spec, try_first_with, app_data, env):
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 150, in propose_interpreters
    for exe, impl_must_match in find_candidates(path):
                                ^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/discovery/builtin.py", line 210, in path_exes
    for exe in path.iterdir():
               ^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/pathlib.py", line 1056, in iterdir
    for name in os.listdir(self):
                ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/system_ext/bin