Skip to content

Conversation

@konstin
Copy link
Member

@konstin konstin commented Oct 23, 2025

For some reason, I'm encountering broken PBS venvs again (astral-sh/python-build-standalone#380). Instead of showing the inscrutable error to the user, we point them to the PBS bug and ask them to run uv venv.

Fixed a duplicate "exit code" in the first commit.

Before

$ uv sync
error: Querying Python at `/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3` failed with exit status exit status: 1

[stderr]
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 = '/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3'
  isolated = 1
  environment = 0
  user site = 0
  safe_path = 1
  import site = 1
  is in build tree = 0
  stdlib dir = '/install/lib/python3.12'
  sys._base_executable = '/home/konsti/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/bin/python3.12'
  sys.base_prefix = '/install'
  sys.base_exec_prefix = '/install'
  sys.platlibdir = 'lib'
  sys.executable = '/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3'
  sys.prefix = '/install'
  sys.exec_prefix = '/install'
  sys.path = [
    '/install/lib/python312.zip',
    '/install/lib/python3.12',
    '/install/lib/python3.12/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 0x000078e48b835740 (most recent call first):
  <no Python frame>

After

$ uv sync
  error: Can't use Python at `/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3`
    Caused by: Python is missing PYTHONHOME. If you are using a managed Python interpreter, this is a known bug (https://github.com/astral-sh/python-build-standalone/issues/380). You can recreate the virtual environment with `uv venv`.

Previously:

```
error: Querying Python at `/home/konsti/projects/pdm/.venv/bin/python3` failed with exit status exit status: 1
```
@konstin konstin added the error messages Messaging when something goes wrong label Oct 23, 2025
Caused by: Python is missing PYTHONHOME. If you are using a managed Python interpreter, this is a known bug (https://github.com/astral-sh/python-build-standalone/issues/380). You can recreate the virtual environment with `uv venv`.
");

// By default, we skip broken interpreters
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't ideal but it's consistent with the existing logic.

For some reason, I'm encountering broken PBS venvs again (astral-sh/python-build-standalone#380). Instead of showing the obscure error to the user, we point them to the PBS bug and ask them to run `uv venv`.

```
$ uv sync
error: Querying Python at `/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3` failed with exit status exit status: 1

[stderr]
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 = '/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3'
  isolated = 1
  environment = 0
  user site = 0
  safe_path = 1
  import site = 1
  is in build tree = 0
  stdlib dir = '/install/lib/python3.12'
  sys._base_executable = '/home/konsti/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/bin/python3.12'
  sys.base_prefix = '/install'
  sys.base_exec_prefix = '/install'
  sys.platlibdir = 'lib'
  sys.executable = '/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3'
  sys.prefix = '/install'
  sys.exec_prefix = '/install'
  sys.path = [
    '/install/lib/python312.zip',
    '/install/lib/python3.12',
    '/install/lib/python3.12/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 0x000078e48b835740 (most recent call first):
  <no Python frame>
```

```
$ uv-debug sync
  error: Can't use Python at `/tmp/uv/tests/.tmpwXZRTI/temp/.venv/bin/python3`
    Caused by: Python is missing PYTHONHOME. If you are using a managed Python interpreter, this is a known bug (astral-sh/python-build-standalone#380). You can recreate the virtual environment with `uv venv`.
```
@konstin konstin force-pushed the konsti/hint-at-broken-interpreter branch from cc44be0 to 1bee45b Compare October 23, 2025 15:41
@konstin konstin temporarily deployed to uv-test-registries October 23, 2025 15:48 — with GitHub Actions Inactive
@zanieb
Copy link
Member

zanieb commented Oct 23, 2025

cc @geofft

@konstin konstin temporarily deployed to uv-test-registries October 23, 2025 15:53 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Messaging when something goes wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants