Skip to content

Python installed via uv doesn't work with tox #15334

@canepan

Description

@canepan

Summary

Kernel: 6.12.10-76061203-generic

Repo: https://github.com/canepan/bot

Commands to reproduce (on a system without Python 3.11):

uv python install cpython3.11
uvx tox

Expecting tox to run correctly, but instead the following is shown for py311 (py310 from OS works OK):

py311: install_deps> python -I -m pip install 'flake8<5.0.0' 'importlib-metadata<5.0' pytest-black 'pytest-cov<6.0' 'pytest-flake8; python_version < "3.12"' pytest-mypy pytest-pudb 'pytest<7' setuptools types-mock
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/home/nicola/Documenti/dev/tools/.tox/py311/bin/python'
  isolated = 1
  environment = 0
  user site = 0
  safe_path = 1
  import site = 1
  is in build tree = 0
  stdlib dir = '/install/lib/python3.11'
  sys._base_executable = '/home/nicola/.local/share/uv/python/cpython-3.11.13-linux-x86_64-gnu/bin/python3.11'
  sys.base_prefix = '/install'
  sys.base_exec_prefix = '/install'
  sys.platlibdir = 'lib'
  sys.executable = '/home/nicola/Documenti/dev/tools/.tox/py311/bin/python'
  sys.prefix = '/install'
  sys.exec_prefix = '/install'
  sys.path = [
    '/install/lib/python311.zip',
    '/install/lib/python3.11',
    '/install/lib/python3.11/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007df16616d740 (most recent call first):
  <no Python frame>
py311: exit 1 (0.02 seconds) /home/nicola/Documenti/dev/tools> python -I -m pip install 'flake8<5.0.0' 'importlib-metadata<5.0' pytest-black 'pytest-cov<6.0' 'pytest-flake8; python_version < "3.12"' pytest-mypy pytest-pudb 'pytest<7' setuptools types-mock pid=2468762
  py39: SKIP (0.04 seconds)
  py310: OK (10.06=setup[4.41]+cmd[5.65] seconds)
  py311: FAIL code 1 (0.02 seconds)
  evaluation failed :( (10.17 seconds)

Platform

Pop!_OS Linux x86_64 22.04 LTS

Version

uv 0.8.11

Python version

Python 3.11.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions