Feature or enhancement
Proposal:
Currently, if we don't find the standard library, we fail with an obscure message.
$ PYTHONHOME=nonsense ./python-c'print("foo!")'FatalPythonerror: FailedtoimportencodingsmodulePythonruntimestate: coreinitializedExceptionignoredintheinternaltracebackmachinery:
ModuleNotFoundError: Nomodulenamed'traceback'ModuleNotFoundError: Nomodulenamed'encodings'Stack (mostrecentcallfirst):This is a common problem, as can be seen with a quick google search. One of the top results is a nonsense AI slop blogpost.
It is generally caused or a misconfigured Python home directory, either by setting PYTHONHOME, or by broken virtual environments.
It would be helpful to show a warning if we are unable to find a valid standard library during initialization.
WARN: Couldnotfindthestandardlibrarydirectory! ThePython'home'directorywassetto'nonsense', isthiscorrect?
FatalPythonerror: FailedtoimportencodingsmodulePythonruntimestate: coreinitializedExceptionignoredintheinternaltracebackmachinery:
ModuleNotFoundError: Nomodulenamed'traceback'ModuleNotFoundError: Nomodulenamed'encodings'Stack (mostrecentcallfirst):
Bad ._pth files can also cause this.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
Currently, if we don't find the standard library, we fail with an obscure message.
This is a common problem, as can be seen with a quick google search. One of the top results is a nonsense AI slop blogpost.
It is generally caused or a misconfigured Python home directory, either by setting
PYTHONHOME, or by broken virtual environments.It would be helpful to show a warning if we are unable to find a valid standard library during initialization.
Bad
._pthfiles can also cause this.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs