Skip to content

Package installation fails with "module '__main__' has no attribute '__file__'" when uv inspects venv python #1596

@gara88890

Description

@gara88890

What happened?

Package

Stable Diffusion WebUI Forge - Neo (also reproducible with Stable Diffusion WebUI Forge)

When did the issue occur?

Installing the Package

What GPU / hardware type are you using?

RTX 5090, AMD64 Family 26 Model 68 (Ryzen), Windows 11

What happened?

All package installations fail with the following error. This started after manually installing Style-Bert-VITS2 outside of Stability Matrix (which modified the system Python 3.10 environment).

Even after:

  • Deleting and re-downloading Assets\Python310
  • Uninstalling system Python 3.10 completely
  • Clearing uv cache at %LOCALAPPDATA%\uv
  • Reinstalling Stability Matrix

The error persists.

Error Log

Could not install forge-neo (StabilityMatrix.Core.Exceptions.ProcessException: pip install failed with code 2: 'error: Failed to inspect Python interpreter from provided path at venv\Scripts\python.exe
Caused by: Querying Python at H:\StabilityMatrix-win-x64\Data\Packages\Stable Diffusion WebUI Forge - Neo\venv\Scripts\python.exe failed with exit status exit code: 1
[stderr]
AttributeError: module 'main' has no attribute 'file'. Did you mean: 'name'?

Root Cause Analysis

uv 0.9.30 (bundled with Stability Matrix 2.15.6) inspects the venv Python interpreter using:

python.exe -c "import sys; print(sys.file)"

However, __file__ is not defined when Python is run with -c flag — this is standard Python behavior. This causes uv to fail when inspecting any venv interpreter.

Steps to Reproduce

  1. Install system Python 3.10 and add to PATH
  2. Use system Python to install packages (e.g. Style-Bert-VITS2)
  3. Remove system Python from PATH or uninstall it
  4. Try to install any package in Stability Matrix 2.15.6

Expected Behavior

Package installation should succeed regardless of system Python state.

Stability Matrix Version

2.15.6

Additional Info

  • uv version bundled: 0.9.30
  • uv 0.11.4 has the same behavior when called by Stability Matrix (SM overwrites uv.exe on startup)
  • Both Forge Neo and ComfyUI installations fail with identical errors

Steps to reproduce

No response

Relevant logs

Version

v2.15.6

What Operating System are you using?

Windows

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