Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError about a log directory with uv-venv-lock-runner #121

Closed
azmeuk opened this issue Nov 2, 2024 · 3 comments
Closed

FileNotFoundError about a log directory with uv-venv-lock-runner #121

azmeuk opened this issue Nov 2, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@azmeuk
Copy link

azmeuk commented Nov 2, 2024

Issue

On a simple environment, when running tox-uv with the uv-venv-lock-runner on a different python version that the on installed on the system, tox fails with a FileNotFoundError related to a log directory. I suppose this error hides another one, the one that was intended to be logged.

I have python 3.12 installed system wide, the errror does not happen with tox -e py312.
With the default runner I cannot observe this bug.

Environment

Provide at least:

  • OS: Archlinux
Output of pip list of the host Python, where tox is installed
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
platformdirs  4.3.6
pluggy        1.5.0
pyproject-api 1.8.0
tox           4.23.2
tox-uv        1.16.0
uv            0.4.29
virtualenv    20.27.1

Output of running tox

Output of tox -rvv
tox -rvv -e py313
py313: 202 W remove tox env folder /home/eloi/dev/tox-uv-test/.tox/py313 [tox/tox_env/api.py:325]
py313: 206 W venv> .venv/bin/uv venv -p 3.13 --allow-existing -v /home/eloi/dev/tox-uv-test/.tox/py313 [tox/tox_env/api.py:427]
DEBUG uv 0.4.29
DEBUG Found project root: `/home/eloi/dev/tox-uv-test`
DEBUG No workspace root found, using project root
DEBUG Searching for Python 3.13 in managed installations or system path
DEBUG Searching for managed installations at `/home/eloi/.local/share/uv/python`
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/home/eloi/dev/tox-uv-test/.venv/bin/python` (search path)
DEBUG Ignoring Python interpreter at `/home/eloi/dev/tox-uv-test/.venv/bin/python`: system interpreter required
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/home/eloi/dev/tox-uv-test/.venv/bin/python3` (search path)
DEBUG Ignoring Python interpreter at `/home/eloi/dev/tox-uv-test/.venv/bin/python3`: system interpreter required
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/usr/bin/python` (search path)
DEBUG Skipping interpreter at `/usr/bin/python` from search path: does not satisfy request `3.13`
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/usr/bin/python3` (search path)
DEBUG Skipping interpreter at `/usr/bin/python3` from search path: does not satisfy request `3.13`
DEBUG Found `cpython-3.13.0-linux-x86_64-gnu` at `/usr/bin/python3.13` (search path)
Using CPython 3.13.0 interpreter at: /usr/bin/python3.13
Creating virtual environment at: .tox/py313
DEBUG Allowing existing directory
py313: 246 I exit 0 (0.04 seconds) /home/eloi/dev/tox-uv-test> .venv/bin/uv venv -p 3.13 --allow-existing -v /home/eloi/dev/tox-uv-test/.tox/py313 pid=366383 [tox/execute/api.py:286]
py313: 247 W uv-sync> uv sync --frozen --no-dev -v [tox/tox_env/api.py:427]
DEBUG uv 0.4.29
DEBUG Found project root: `/home/eloi/dev/tox-uv-test`
DEBUG No workspace root found, using project root
DEBUG Reading requests from `/home/eloi/dev/tox-uv-test/.python-version`
DEBUG The virtual environment's Python version does not satisfy `Python 3.12`
DEBUG Searching for Python 3.12 in managed installations or system path
DEBUG Searching for managed installations at `/home/eloi/.local/share/uv/python`
DEBUG Found `cpython-3.13.0-linux-x86_64-gnu` at `/home/eloi/dev/tox-uv-test/.tox/py313/bin/python` (search path)
DEBUG Ignoring Python interpreter at `/home/eloi/dev/tox-uv-test/.tox/py313/bin/python`: system interpreter required
DEBUG Found `cpython-3.13.0-linux-x86_64-gnu` at `/home/eloi/dev/tox-uv-test/.tox/py313/bin/python3` (search path)
DEBUG Ignoring Python interpreter at `/home/eloi/dev/tox-uv-test/.tox/py313/bin/python3`: system interpreter required
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/home/eloi/dev/tox-uv-test/.venv/bin/python` (search path)
DEBUG Ignoring Python interpreter at `/home/eloi/dev/tox-uv-test/.venv/bin/python`: system interpreter required
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/home/eloi/dev/tox-uv-test/.venv/bin/python3` (search path)
DEBUG Ignoring Python interpreter at `/home/eloi/dev/tox-uv-test/.venv/bin/python3`: system interpreter required
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/home/eloi/dev/tox-uv-test/.venv/bin/python3.12` (search path)
DEBUG Ignoring Python interpreter at `/home/eloi/dev/tox-uv-test/.venv/bin/python3.12`: system interpreter required
DEBUG Found `cpython-3.12.7-linux-x86_64-gnu` at `/usr/bin/python` (search path)
Using CPython 3.12.7 interpreter at: /usr/bin/python
Removed virtual environment at: .tox/py313
Creating virtual environment at: .tox/py313
DEBUG Using request timeout of 30s
Audited in 0.00ms
py313: 262 E internal error [tox/session/cmd/run/single.py:60]
Traceback (most recent call last):
  File "/home/eloi/dev/tox-uv-test/.venv/lib/python3.12/site-packages/tox/session/cmd/run/single.py", line 47, in _evaluate
    tox_env.setup()
  File "/home/eloi/dev/tox-uv-test/.venv/lib/python3.12/site-packages/tox/tox_env/api.py", line 250, in setup
    self._setup_env()
  File "/home/eloi/dev/tox-uv-test/.venv/lib/python3.12/site-packages/tox_uv/_run_lock.py", line 77, in _setup_env
    outcome = self.execute(cmd, stdin=StdinSource.OFF, run_id="uv-sync", show=show)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eloi/dev/tox-uv-test/.venv/lib/python3.12/site-packages/tox/tox_env/api.py", line 389, in execute
    with self.execute_async(cmd, stdin, show, cwd, run_id, executor) as status:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/home/eloi/dev/tox-uv-test/.venv/lib/python3.12/site-packages/tox/tox_env/api.py", line 443, in execute_async
    self._log_execute(request, execute_status)
  File "/home/eloi/dev/tox-uv-test/.venv/lib/python3.12/site-packages/tox/tox_env/api.py", line 449, in _log_execute
    self._write_execute_log(self.name, self.env_log_dir / f"{self._log_id}-{request.run_id}.log", request, status)
  File "/home/eloi/dev/tox-uv-test/.venv/lib/python3.12/site-packages/tox/tox_env/api.py", line 453, in _write_execute_log
    with log_file.open("wt", encoding="utf-8") as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 1013, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/eloi/dev/tox-uv-test/.tox/py313/log/2-uv-sync.log'
  py313: FAIL code 2 (0.06 seconds)
  evaluation failed :( (0.13 seconds)

Minimal example

pyproject.toml

[project]
name = "tox-uv-test"
version = "0.1.0"

[dependency-groups]
dev = [
    "tox-uv>=1.16.0",
]

[tool.tox]
env_list = [
    "py310",
    "py311",
    "py312",
    "py313",
]

[tool.tox.env_run_base]
runner = "uv-venv-lock-runner"
commands = [["python", "--version"]]
@azmeuk azmeuk added the bug Something isn't working label Nov 2, 2024
@gaborbernat
Copy link
Member

I can't reproduce this with the information provided. Can you provide a reproducible within a docker image?

@azmeuk
Copy link
Author

azmeuk commented Nov 3, 2024

I could not reproduce with this Dockerfile, so I suppose there is something going on with the Python versions installed on my system. I will do more checks tomorrow.

FROM archlinux:latest

RUN pacman -Syu --noconfirm
RUN pacman -S python-uv --noconfirm

WORKDIR /opt/foobar
COPY uv.lock pyproject.toml /opt/foobar/
RUN uv sync
RUN uv run tox --version
RUN uv run tox

@RomainBrault
Copy link
Contributor

This is #110 (same error message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants