Conversation
Two independent issues that block `python scripts/start_web.py` after a
clean install on Windows:
1. UnicodeDecodeError when streaming subprocess output
`_spawn()` opened the backend / frontend stdout pipe with `text=True`
but no explicit encoding. On Windows this defaults to the system
ANSI codepage (e.g. `gbk` on Chinese Windows), which raises
`UnicodeDecodeError` as soon as the child process emits a UTF-8 byte.
Fix: pin `encoding="utf-8"` and `errors="replace"` so any locale
produces clean, lossless output.
2. Missing runtime dependencies in requirements/server.txt
`deeptutor/services/llm/provider_core/__init__.py` unconditionally
imports `AnthropicProvider`, `OpenAICompatProvider`, and
`OpenAIResponses`, which in turn import:
- `loguru` (provider_core/base.py, openai_codex_provider.py,
openai_responses/parsing.py)
- `json_repair` (anthropic_provider.py, openai_compat_provider.py,
openai_responses/parsing.py)
These are declared only in `requirements/tutorbot.txt`, so
`pip install -r requirements/server.txt && pip install -e .` followed
by `python scripts/start_web.py` crashes with `ModuleNotFoundError`
before the API server can serve a single request.
Fix: declare both packages in `server.txt` with the same version
bounds used by `tutorbot.txt`.
Reproduced and verified on Windows 11 + Python 3.12 + a fresh venv.
Collaborator
|
Thanks!! This is a good one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent issues that block
python scripts/start_web.pyafter a clean install on Windows. Both block users from reaching the API server, so I'm bundling them into a single PR.Issue 1 —
UnicodeDecodeErrorstreaming subprocess output_spawn()opens the backend / frontend stdout pipes withtext=Truebut no explicitencoding. On Windows,text=Truefalls back to the system ANSI codepage (e.g.gbkon Chinese Windows). The reader thread crashes the moment a child process emits a UTF-8 byte:Fix
Pin
encoding=""utf-8""anderrors=""replace""on thePopenkwargs. Both Node 24 (Next.js dev) and the FastAPI/uvicorn backend write UTF-8 to stdout, so this matches the actual byte stream and is locale-independent.Issue 2 —
ModuleNotFoundError: loguru/json_repairafterpip install -r requirements/server.txtdeeptutor/services/llm/provider_core/__init__.pyunconditionally imports:AnthropicProvider→import json_repairOpenAICompatProvider→import json_repairOpenAICodexProvider→from loguru import loggerprovider_core/base.py→from loguru import loggeropenai_responses/parsing.py→ bothBoth packages are declared only in
requirements/tutorbot.txt. So the documented install path for the web server:crashes the uvicorn worker before it can serve a single request:
Fix
Add both packages to
requirements/server.txtwith the same version bounds already used intutorbot.txt:These are core LLM-provider dependencies, not TutorBot-specific, so the right home is
server.txt.Reproduction
ModuleNotFoundErrorbefore serving a request.Verification
Tested on Windows 11 + Python 3.12.1 + a fresh
.venv. After applying both fixes,python scripts/start_web.pyboots cleanly:Uvicorn running on http://0.0.0.0:8001Next.js Ready in <1sFrontend page loads and successfully reaches the backend
/api/...routes.