Failing to import Blender as a python module #50359
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#50359
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have successfully managed to build Blender as a Python module using the pre-existing 'make bpy' command both on Linux x64 and Windows 7 x64. Importing the bpy module later on works nicely from within Linux, even when configuring Eclipse to do so using the PyDev extension. I get very clean and reliable code completion. However, when trying to import bpy on Windows from a Python shell, the following error is thrown:
importing Python first
//Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.//
get the current paths
['', 'C:\Program Files\Python35\python35.zip', 'C:\Program Files\Python35\DLLs', 'C:\Program Files\Python35\lib', 'C:\Program Files\Python35', 'C:\Program Files\Python35\lib\site-packages']
append the build path
import the module
//bpy: couldnt find 'scripts/modules', blender probably wont start.
Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
ImportError: No module named 'bpy_types'
ImportError: No module named 'bpy_types'
pyrna_srna_ExternalType: failed to find 'bpy_types' module
ImportError: No module named 'bpy_types'
ImportError: No module named 'bpy_types'
pyrna_srna_ExternalType: failed to find 'bpy_types' module
ImportError: No module named 'bpy_types'
pyrna_srna_ExternalType: failed to find 'bpy_types' module
F0102 11:21:26.276347 8560 utilities.cc:322] Check failed: !IsGoogleLoggingInitialized() You called InitGoogleLogging() twice!
Check failure stack trace://
At this point, Python crashes and gives me that infamous 'Send Information' window.
Changed status to: 'Open'
Added subscriber: @RainerTrummer
Added subscriber: @mont29
Changed status from 'Open' to: 'Archived'
I would suggest you first try from a raw python console (from MS command line, not from MSVC one).
Besides, thanks for the report, but I see no Blender bug here, this is a problem of python not finding modules, i.e. not having the right paths for some reason, configuration issue.
Please seek support on user forums like blenderartists.org or blender.stackexchange.com.
Thanks for your feedback,I will try your suggestions next Monday when I am back in the office.
Just verified the suggestions. Using the raw Pyhton console made no difference, import errors would remain the same. But following the guide here http://www.gizmoplex.com/wordpress/compile-blender-as-python-module/ (especially the part of copying the needed libs over to the Python35 directory) made it work. Can now successfully use the bpy build!
I meant this guide: http://www.gizmoplex.com/wordpress/compile-blender-as-python-module/