tox-dev / tox

Command line driven CI frontend and development task automation tool.
https://tox.wiki
MIT License
3.67k stars 521 forks source link

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

Closed mgedmin closed 3 hours ago

mgedmin commented 4 hours 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

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

Environment

Provide at least:

Output of pip list of the host Python, where tox is installed ```console $ 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.1 ```

Output of running tox

Output of tox -rvv ```console $ tox -rvv .pkg: 571 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: 572 D filesystem is case-sensitive [virtualenv/info.py:25] .pkg: 574 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: 575 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: 575 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: 667 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: 668 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: 668 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: 676 I find interpreter for spec PythonSpec(major=3, minor=12) [virtualenv/discovery/builtin.py:73] .pkg: 676 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: 676 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: 683 I find interpreter for spec PythonSpec(major=3, minor=13) [virtualenv/discovery/builtin.py:73] .pkg: 683 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: 683 D discover PATH[0]=/data/data/com.termux/files/home/bin [virtualenv/discovery/builtin.py:149] .pkg: 690 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 N0OSS5OYVRURUGg3TsLDMtwMeT5bGHz6 7WPLU2nigNZNwTwi6kHraVb31Eb0tpeI [virtualenv/discovery/cached_py_info.py:112] .pkg: 704 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: 704 D discover PATH[1]=/data/data/com.termux/files/home/bin/local [virtualenv/discovery/builtin.py:149] .pkg: 704 D discover PATH[2]=/data/data/com.termux/files/home/.local/bin [virtualenv/discovery/builtin.py:149] .pkg: 707 D discover PATH[3]=/data/data/com.termux/files/usr/bin [virtualenv/discovery/builtin.py:149] .pkg: 712 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: 713 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: 714 D discover PATH[4]=/apex/com.android.runtime/bin [virtualenv/discovery/builtin.py:149] .pkg: 715 D discover PATH[5]=/apex/com.android.art/bin [virtualenv/discovery/builtin.py:149] .pkg: 715 D discover PATH[6]=/system_ext/bin [virtualenv/discovery/builtin.py:149] .pkg: 725 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: 726 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: 726 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: 732 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: 733 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: 733 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' ```

Minimal example

$ tox

Additional information

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 Tox's interpreter discovery would skip it instead of failing entirely.

gaborbernat commented 3 hours ago

The stacktrace shows that this issue is not with this tool but with virtualenv.

mgedmin commented 3 hours ago

Looking closer at the traceback it looks like it's virtualenv itself that's looping through the PATH. Maybe I should open a virtualenv bug? However, when virtualenv is being called by tools like pipx I don't see this issue, so tox must be doing something differently. Running virtualenv manually also doesn't have any issues.

gaborbernat commented 3 hours ago

I am not sure. However, we are not doing anything special.