blender as py module - Addon installation succeeds but the API is not accessible through the bpy module #56829
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#56829
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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 compiled Blender 2.79b as a Python3 module on Ubuntu 16.04 LTS. I install an addon using
bpy.ops.wm.addon_install()
, enable it usingbpy.ops.wm.addon_enable(module='packageName)
and save the user preferences usingbpy.ops.wm.save_userpref()
. However, after I open Python3 again and doimport bpy
I cannot see the addon API's being added to the bpy module. If I run the same exact "addon installation" script when using Blender with the GUI everything works fine, but not when I have compiled Blender as a Python module. It looks like this must be a bug so I decided to post it here.In case you're wondering, this is the addon I'm trying to install and below is the script I used to do the installation:
installArmory.sh
installArmory.py
Added subscriber: @AmirS
Added subscribers: @ideasman42, @mont29
@ideasman42 will know more here, but am pretty sure blender-as-py-module does not handle at all user preferences and such? That would not make much sense at least, imho…
Addon installation succeeds but the API is not accessible through the bpy moduleto blender as py module - Addon installation succeeds but the API is not accessible through the bpy moduleAdded subscriber: @brecht
Changed status from 'Open' to: 'Archived'
The Python module indeed always starts with "factory settings" by design. This is what you would normally expect from a programming API I think.
@ideasman42 @brecht But it doesn't make sense not to be able to install addons if you're using the Python module. The Python module should be Blender with no GUI in my opinion and there shouldn't be any difference. Would you agree with that?
But still, is there a way to manually load a
userpref.blend
file with the Python module? How can one install addons when using the Python module?@AmirS no, blender-as-module is a library, not an application. Blender with no GUI is… Blender with no GUI (run from commandline with
-b
option, you can even build it withWITH_HEADLESS
option to actually have no available GUI at all).So I guess you'd have to handle extra add-ons yourself (i.e. call register helpers yourself every time you need it). Not sure many add-ons will work correctly in blender-as-module context anyway.
@mont29 I don't have an issue running Blender with the
-b
flag but the reason that I'm compiling Blender as Python module is that I have many other packages that I'm using in my project and things are integrated. I doimport pytorch
,import cv2
etc and it's not possible to disentangle things. On the other hand, I don't think it is possible to compile a heavy code base like PyTorch and add its module into the internal Python that Blender comes with.So I would really appreciate if someone can give me some clues on how I can install an addon when using Python module-compiled version of Blender. Like how I can manually register this new addon so that its API shows up in the
bpy
module.@brecht I think it's totally understandable to assume that people who compile Blender as Python module would ONLY need to use the "factory setting" functionalities, but it's not a good idea not to provide an option for others to be able to install addons :(
I'm not sure I understand, doesn't
bpy.ops.wm.addon_enable(module='armory')
work, you just have to call it every time?@brecht No it shows me the following error although I ran the code above to install it.
@brecht I think I fixed it actually but this is not a permanent solution and I'm not sure if Armory is going to work properly this way.
Here are the steps:
Now
arm
shows up inbpy.ops
but I don't think this could be a permanent solution. It would be great if installing addons can be more supported in a more coherent way.@AmirS nothing prevents you from using system python instead of 'own' blender one, just ensuer you build with system python, disable the
WITH_PYTHON_INSTALL
build options, and blender will use system python, and you can use any module installed there. That would be by far the simplest solution (especially on linux, where valid system python should nearly always be available).besides, to “enable” any random add-on (or module) from any random place, something like that should work:
sys.path
import
the add-on/modulecall its
register
methodThat’s kind of basic python module handling really…
Also please note that We do not handle user support on this tracker, only bug reports. User forums like blenderartists.org or blender.stackexchange.com should be used for that matter.