Blender Python Initilization Crash? #35785

Closed
opened 2013-06-17 13:30:06 +02:00 by Terry Wallwork · 17 comments

%%%--- Operating System, Graphics card ---

Fedora 18 - Intel HD 3000

- Blender version with error, and version that worked ---

Blender-2.67-SVN57516-x86_64-GNU-Linux < does not work

- Short description of error ---

Starting Blender it crashes and am left with the following on terminal:

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted (core dumped)

I have attached a backtrace file. Version 57284 worked fine, just happens with recent version. I was using the same custom build of python 3.2 in all builds.

- Steps for others to reproduce the error (preferably based on attached .blend file) ---

%%%

%%%--- Operating System, Graphics card --- Fedora 18 - Intel HD 3000 - Blender version with error, and version that worked --- Blender-2.67-SVN57516-x86_64-GNU-Linux < does not work - Short description of error --- Starting Blender it crashes and am left with the following on terminal: Fatal Python error: Py_Initialize: Unable to get the locale encoding ImportError: No module named 'encodings' Aborted (core dumped) I have attached a backtrace file. Version 57284 worked fine, just happens with recent version. I was using the same custom build of python 3.2 in all builds. - Steps for others to reproduce the error (preferably based on attached .blend file) --- %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

%%%I also tried doing a fresh build of Python and Blender. Made no difference still got the crash.%%%

%%%I also tried doing a fresh build of Python and Blender. Made no difference still got the crash.%%%

%%%This error message typically happens when the python library (libpython3.3m.so) can be found but the "encodings" dir cant'. be found.

Try run:

strace ./blender.bin 2>&1 | grep encoding

For me the output shows...

stat("/usr/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/lib/python3.3/encodings/init.cpython-33m.so", 0x7fffc4b79190) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.3/encodings/init.abi3.so", 0x7fffc4b79190) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.3/encodings/init.so", 0x7fffc4b79190) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.3/encodings/init.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0
stat("/usr/lib/python3.3/encodings/init.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0

As you can see, its found eventually.%%%

%%%This error message typically happens when the python library (libpython3.3m.so) can be found but the "encodings" dir cant'. be found. Try run: strace ./blender.bin 2>&1 | grep encoding For me the output shows... stat("/usr/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/usr/lib/python3.3/encodings/__init__.cpython-33m.so", 0x7fffc4b79190) = -1 ENOENT (No such file or directory) stat("/usr/lib/python3.3/encodings/__init__.abi3.so", 0x7fffc4b79190) = -1 ENOENT (No such file or directory) stat("/usr/lib/python3.3/encodings/__init__.so", 0x7fffc4b79190) = -1 ENOENT (No such file or directory) stat("/usr/lib/python3.3/encodings/__init__.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0 stat("/usr/lib/python3.3/encodings/__init__.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0 As you can see, its found eventually.%%%
Author

%%%When i run strace I get:

write(2, "Fatal Python error: Py_Initializ"..., 69Fatal Python error: Py_Initialize: Unable to get the locale encoding
write(2, "No module named 'encodings'", 27No module named 'encodings') = 27

Older version of Blender with the same version of python seem to work ok.

Anything else I can try.%%%

%%%When i run strace I get: write(2, "Fatal Python error: Py_Initializ"..., 69Fatal Python error: Py_Initialize: Unable to get the locale encoding write(2, "No module named 'encodings'", 27No module named 'encodings') = 27 Older version of Blender with the same version of python seem to work ok. Anything else I can try.%%%
Author

%%%Also with a working version I get this (svn 57284 with same version of python):

[terry@TERRY-LAPTOP bin]$ strace ./blender 2>&1 | grep encoding
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/init.cpython-33m.so", 0x7fff6db20610) = -1 ENOENT (No such file or directory)
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/init.abi3.so", 0x7fff6db20610) = -1 ENOENT (No such file or directory)
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/init.so", 0x7fff6db20610) = -1 ENOENT (No such file or directory)
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/init.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/init.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0
open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/pycache/init.cpython-33.pyc", O_RDONLY) = 12
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 12
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/aliases.py", {st_mode=S_IFREG|0644, st_size=15133, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/aliases.py", {st_mode=S_IFREG|0644, st_size=15133, ...}) = 0
open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/pycache/aliases.cpython-33.pyc", O_RDONLY) = 12
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/utf_8.py", {st_mode=S_IFREG|0644, st_size=1005, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/utf_8.py", {st_mode=S_IFREG|0644, st_size=1005, ...}) = 0
open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/pycache/utf_8.cpython-33.pyc", O_RDONLY) = 12
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/latin_1.py", {st_mode=S_IFREG|0644, st_size=1264, ...}) = 0
stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/latin_1.py", {st_mode=S_IFREG|0644, st_size=1264, ...}) = 0
open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/pycache/latin_1.cpython-33.pyc", O_RDONLY) = 12
read(12, "ct_encoding\tJISX0201.1976-0:GR\n}"..., 4096) = 110
%%%

%%%Also with a working version I get this (svn 57284 with same version of python): [terry@TERRY-LAPTOP bin]$ strace ./blender 2>&1 | grep encoding stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__init__.cpython-33m.so", 0x7fff6db20610) = -1 ENOENT (No such file or directory) stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__init__.abi3.so", 0x7fff6db20610) = -1 ENOENT (No such file or directory) stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__init__.so", 0x7fff6db20610) = -1 ENOENT (No such file or directory) stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__init__.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__init__.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0 open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__pycache__/__init__.cpython-33.pyc", O_RDONLY) = 12 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 openat(AT_FDCWD, "/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 12 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/aliases.py", {st_mode=S_IFREG|0644, st_size=15133, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/aliases.py", {st_mode=S_IFREG|0644, st_size=15133, ...}) = 0 open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__pycache__/aliases.cpython-33.pyc", O_RDONLY) = 12 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/utf_8.py", {st_mode=S_IFREG|0644, st_size=1005, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/utf_8.py", {st_mode=S_IFREG|0644, st_size=1005, ...}) = 0 open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__pycache__/utf_8.cpython-33.pyc", O_RDONLY) = 12 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/latin_1.py", {st_mode=S_IFREG|0644, st_size=1264, ...}) = 0 stat("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/latin_1.py", {st_mode=S_IFREG|0644, st_size=1264, ...}) = 0 open("/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python/lib/python3.3/encodings/__pycache__/latin_1.cpython-33.pyc", O_RDONLY) = 12 read(12, "ct_encoding\tJISX0201.1976-0:GR\n}"..., 4096) = 110 %%%
Author

%%%Yet more investigating and I found something odd, directory names have changed between:

/home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python

and

/home/terry/BLENDERBINARIES/Blender-2.67-SVN57518-x86_64-GNU-Linux/share/blender/2.67/python

57284 has a lib directory, 57518 has lib64.

Is this a cmake change I didn't know about?%%%

%%%Yet more investigating and I found something odd, directory names have changed between: /home/terry/BLENDERBINARIES/Blender-2.67-SVN57284-x86_64-GNU-Linux/share/blender/2.67/python and /home/terry/BLENDERBINARIES/Blender-2.67-SVN57518-x86_64-GNU-Linux/share/blender/2.67/python 57284 has a lib directory, 57518 has lib64. Is this a cmake change I didn't know about?%%%
Author

%%%And just to clarify I didn't change any build options between the two builds. So what I mean to say is did something in cmake change that altered where the python lib directories get placed?%%%

%%%And just to clarify I didn't change any build options between the two builds. So what I mean to say is did something in cmake change that altered where the python lib directories get placed?%%%
Author

%%%Further update, manually renaming the lib64 directory to lib, makes the newer version run fine. So i am innocent its all cmakes fault! :P%%%

%%%Further update, manually renaming the lib64 directory to lib, makes the newer version run fine. So i am innocent its all cmakes fault! :P%%%
Author

%%%Yet another update apparently some clever dev type/sneaky bugger added a new cmake option PYTHON_LIBPATH and since I didn't set it, it set its value to /usr/lib64. Even though I had already set PYTHON_LIBRARY.%%%

%%%Yet another update apparently some clever dev type/sneaky bugger added a new cmake option PYTHON_LIBPATH and since I didn't set it, it set its value to /usr/lib64. Even though I had already set PYTHON_LIBRARY.%%%

%%%This sneaky bugger could have been me, though a few people have been updating CMake's Python support.

There is a problem that Python sometimes uses lib64 and exactly how to fix this isn't so clear, especially if its working on developers systems.

Can you confirm if a clean build with CMake gives this problem?%%%

%%%This sneaky bugger could have been me, though a few people have been updating CMake's Python support. There is a problem that Python sometimes uses lib64 and exactly how to fix this isn't so clear, especially if its working on developers systems. Can you confirm if a clean build with CMake gives this problem?%%%

%%%if you build blender and get errors you need to help us find a solution if we can't redo the error since developers don't have all configurations available for testing.

But this is a build issue which we don't handle in the tracker.

closing.%%%

%%%if you build blender and get errors you need to help us find a solution if we can't redo the error since developers don't have all configurations available for testing. But this is a build issue which we don't handle in the tracker. closing.%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

%%%Just a note: I got this error running any version of Blender (without building or anything) just by having a very long path to the binary file.

Like: "/media/Drive/Folder/AnotherFolder/OtherFolder/ThatsLong/Tellyou: This is a very long path (2011.11~2012.06+2012.12)/LastFolder"

Or maybe it was because of the colon, parenthesis, tilde or plus signal in the name?%%%

%%%Just a note: I got this error running any version of Blender (without building or anything) just by having a very long path to the binary file. Like: "/media/Drive/Folder/AnotherFolder/OtherFolder/ThatsLong/Tellyou: This is a very long path (2011.11~2012.06+2012.12)/LastFolder" Or maybe it was because of the colon, parenthesis, tilde or plus signal in the name?%%%

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

Sorry for the thread necromancy, but just to make note here for possibly showing up in search results:
An another reason for the error can be the folders (lib, icons, 2.79) being locked - not enough privileges for access. That can happen during unpacking of the tar.bz archive in certain cases using some file managers that display the contents of the archive. In that case, re-extracting the files will solve the issue.

Sorry for the thread necromancy, but just to make note here for possibly showing up in search results: An another reason for the error can be the folders (lib, icons, 2.79) being locked - not enough privileges for access. That can happen during unpacking of the tar.bz archive in certain cases using some file managers that display the contents of the archive. In that case, re-extracting the files will solve the issue.

Added subscriber: @dniku

Added subscriber: @dniku

Saw this crash when I tried to replace the Python bundled in the Snap package using a bind mount, as suggested in this answer . Perhaps the Snap read-only file system is the culprit here?

Saw this crash when I tried to replace the Python bundled in the Snap package using a bind mount, as suggested in [this answer ](https://askubuntu.com/a/1036611/402485). Perhaps the Snap read-only file system is the culprit here?
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 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-addons#35785
No description provided.