Instant crash at startup (fatal python error) #68143

Closed
opened 2019-08-02 19:03:02 +02:00 by Robert · 16 comments

System Information
Operating system: Windows 10
Graphics card: Nvidia GeForce RTX 2070

Blender Version
Broken: 2.80
Worked: 2.79

Newly installed Blender 2.80 crashes instantly at startup. There were no such issues with a previously installed Blender 2.79 version.
Running it from the command line shows that there is a python error (see attached logfile). log.txt

Exact steps for others to reproduce the error

  1. Install Blender 2.80
  2. Try to run blender.exe
**System Information** Operating system: Windows 10 Graphics card: Nvidia GeForce RTX 2070 **Blender Version** Broken: 2.80 Worked: 2.79 Newly installed Blender 2.80 crashes instantly at startup. There were no such issues with a previously installed Blender 2.79 version. Running it from the command line shows that there is a python error (see attached logfile). [log.txt](https://archive.blender.org/developer/F7646080/log.txt) **Exact steps for others to reproduce the error** 1. Install Blender 2.80 2. Try to run blender.exe
Author

Added subscriber: @Robert-Lasch

Added subscriber: @Robert-Lasch
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

does it work when you start blender using the blender_debug_log.cmd batch file located in your blender folder?

does it work when you start blender using the `blender_debug_log.cmd` batch file located in your blender folder?
Author

It does not work and produces a log file with the same error.
blender_debug_output.txt

It does not work and produces a log file with the same error. [blender_debug_output.txt](https://archive.blender.org/developer/F7646088/blender_debug_output.txt)
Member

was this the .msi installer or the .zip?

was this the .msi installer or the .zip?
Author

It was the .msi installer.
It might also be relevant that I have other python distributions installed on the system besides the one bundled with Blender. Could those be interfering with the bundled version?

It was the .msi installer. It might also be relevant that I have other python distributions installed on the system besides the one bundled with Blender. Could those be interfering with the bundled version?
Member

It could be, but the batch file i made you run temporary reset the PYTHONPATH environment variable that it generally uses to find 'the wrong python' so yeah i'm kinda stumped here,

My running theory was the unzip bailed out prematurely but given you didn't use the .zip that's out the window as well.

It could be, but the batch file i made you run temporary reset the PYTHONPATH environment variable that it generally uses to find 'the wrong python' so yeah i'm kinda stumped here, My running theory was the unzip bailed out prematurely but given you didn't use the .zip that's out the window as well.

Added subscriber: @rjg

Added subscriber: @rjg

Looks like an encoding/decoding problem. 0xfc is indeed not valid in UTF-8. Do you happen to have an ü somewhere in a path or file that may be read by Blender? I suspect there is some error where wide characters aren't properly converted to multibyte.

Looks like an encoding/decoding problem. `0xfc` is indeed not valid in UTF-8. Do you happen to have an `ü` somewhere in a path or file that may be read by Blender? I suspect there is some error where wide characters aren't properly converted to multibyte.
Author

I just checked using Process Monitor (https://docs.microsoft.com/en-us/sysinternals/downloads/procmon).
It does not look like Blender is opening any files besides ones from the python/lib directory in the blender installation path. Those shouldn't have any encoding issues, as they were just freshly installed.
The installation path itself also does not contain any umlauts.
Is there anything else I could do to figure out which file is causing the issue?

I just checked using Process Monitor (https://docs.microsoft.com/en-us/sysinternals/downloads/procmon). It does not look like Blender is opening any files besides ones from the python/lib directory in the blender installation path. Those shouldn't have any encoding issues, as they were just freshly installed. The installation path itself also does not contain any umlauts. Is there anything else I could do to figure out which file is causing the issue?
Author

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Robert self-assigned this 2019-08-02 22:38:56 +02:00
Author

Just figured it out. There was a .pth file in a site-packages folder of one of the other python distributions on the system. That file pointed to a path containing an ü.
Apparently this was never a problem for the already installed python distribution, but the one bundled with Blender was sensitive to it.
Removing the offending path in the .pth file resolved the problem.
Thank you everyone.

Just figured it out. There was a .pth file in a site-packages folder of one of the other python distributions on the system. That file pointed to a path containing an `ü`. Apparently this was never a problem for the already installed python distribution, but the one bundled with Blender was sensitive to it. Removing the offending path in the .pth file resolved the problem. Thank you everyone.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

@Robert-Lasch Thank you for investigating this!

@LazyDodo @ideasman42 Is there something about the encoding of .pth files that Blender currently doesn't consider, but can and should? I guess the problem is that the file encoding is assumed to be UTF-8 without trying to identify the actual file encoding?

@Robert-Lasch Thank you for investigating this! @LazyDodo @ideasman42 Is there something about the encoding of .pth files that Blender currently doesn't consider, but can and should? I guess the problem is that the file encoding is assumed to be UTF-8 without trying to identify the actual file encoding?
Member

Ideally python would not be looking at anything outside it's own folder, and should leave other pythons on the system alone, If someone can talk me into re-creating the conditions that @Robert-Lasch was having did i'd be happy to take a stab at this

Ideally python would not be looking at anything outside it's own folder, and should leave other pythons on the system alone, If someone can talk me into re-creating the conditions that @Robert-Lasch was having did i'd be happy to take a stab at this

We try not to interfere with Python defaults so Python developers get an environment which works like a regular installation, however we need to set the standard encoding since Blenders data-block names are utf-8.

Checking site-packages site.py where the error is raised & Python is using open() without any encoding arguments when loading the .pth files.

This might be a bug in Python, since it could set the encoding:

  f = open(fullname, "r", encoding=sys.getfilesystemencoding())

At the very least it could warn but not prevent Python from starting entirely.


Note, this error can be redone in Linux easily.

mkdir -p ~/.local/lib/python3.7/site-packages
python -c 'import sys, random; random.seed(1); sys.stdout.buffer.write(bytes([random.randint(0, 255) for i in range(2000)]))' > ~/.local/lib/python3.7/site-packages/paths.pth

Now Python & Blender fail to start.

We try not to interfere with Python defaults so Python developers get an environment which works like a regular installation, however we need to set the standard encoding since Blenders data-block names are `utf-8`. Checking site-packages `site.py` where the error is raised & Python is using `open()` without any encoding arguments when loading the `.pth` files. This might be a bug in Python, since it could set the encoding: ``` f = open(fullname, "r", encoding=sys.getfilesystemencoding()) ``` At the very least it could warn but not prevent Python from starting entirely. ---- Note, this error can be redone in Linux easily. ``` mkdir -p ~/.local/lib/python3.7/site-packages python -c 'import sys, random; random.seed(1); sys.stdout.buffer.write(bytes([random.randint(0, 255) for i in range(2000)]))' > ~/.local/lib/python3.7/site-packages/paths.pth ``` Now Python & Blender fail to start.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#68143
No description provided.