'Context' object has no attribute 'evaluated_depsgraph_get' on OSX

Dear group,

I’m having some trouble running a python script on OSX (that works on Linux) using the new 2.8 python API for scenegraph evaluation. After building the latest master (6f1752706221b0829cf526a4f6a2c2cf434017d7) and succesfully installing in a virtualenv, the script breaks at the line:

depsgraph = bpy.context.evaluated_depsgraph_get()


AttributeError: ‘Context’ object has no attribute ‘evaluated_depsgraph_get’

even though I’m sure the evaluated_depsgraph_get function is implemented in RNA_blender_cpp.h
and built correctly.

Does anyone have an idea how to fix this?



In the past I have been caught out using “context” - with Animation Nodes for example, you virtually cannot use it at all because the context in the AN Editor is not the context in the 3D view, so things fail. I don’t know, as you haven’t said where you script is running from, or what context you are reading, but the error seems to be saying that the context in use does not have this particular attribute. I am guessing of course, but it might help you.

I just tried your command in Python Console on m Mac and got this:

“evaluate_depsgraph” anything is not part of the context at this level, maybe you are missing something after context…

thanks for your reply, I figured as much as well, and the context is the bpy context as it is after reading a main .blend file. Testing the ‘default’ context however, it appears not to have this function either. I cannot find any documentation on this function other than https://docs.blender.org/api/blender2.8/bpy.types.Depsgraph.html where the example suggests nothing special is being done before calling the evaluated_depsgraph_get. Am I missing something here? how could I find out in which context this function is ‘active’?


Sorry, you are now way outside my knowledge, I know nothin really of depsgraph I have to say, maybe share your code here and someone will be able to help you.

That’s highly strange. I was writing a script just today on this, and this worked perfectly well…


For more information, I’m using a compiled Blender 2.81, but it should work on Blender 2.80 as well…

EDIT: Yup, just confirmed it works on Blender 2.80. I’m calling this from a script tho, it might be because of that.

Which operating system, I think the OP said it works on Linux?

I used both actually. This last attempt was on Linux, and the first attempt on 2.81 was on Mac OS

I’m on OSX 10.13.3
python 3.7.3

import bpy
for o in bpy.data.objects:
…if o.type == “MESH”:
… …o.data.name = “test”
… …bpy.context.evaluated_depsgraph_get().update()

gives me:

2.80 (sub 53)
Traceback (most recent call last):
File “tmp.py”, line 5, in
AttributeError: ‘Context’ object has no attribute ‘evaluated_depsgraph_get’

assuming this script is equivalent to your example wrt updating a dirty depsgraph there is something strange going on here indeed. Tbh I’m rather baffled. Does anyone have any idea what’s going on?

Maybe try compiling 2.81, it works on my end. If even then it doesn’t work, something weirder is going on

hm, maybe this is what’s wrong and I don’t understand blender’s versioning protocol. I built the latest master, giving me 2.80 (sub 53) from the bpy.app.version_string. building commit 189aa32a3ac0 which is the commit used for the 2.81 version offered as a nightly build on https://builder.blender.org/download/ also gives me the same version_string. I’m confused, is there a separate branch for 2.81 that I’m missing?

Would it be possible for you to check your bpy.app.version_string?

update: I checked the binary mentioned above using the built-in python interpreter and indeed that gives me:

>> C.evaluated_depsgraph_get()
<bpy_struct, Depsgraph at 0x7fb96e4f7c98>

>> print(bpy.app.version_string)
2.81 (sub 3)

So now my question becomes, how do I build 2.81 ?

thanks a lot,


From my understanding, master is right now at 2.81. At least there is no tag for 2.81, only 2.80, which I believe would mean that we are now in 2.81. So, just following the instructions here would be enough.

Hope that helps!

Thanks for your reply. We’ve found the issue after a lot of headscratching. The bpy.so file never got built. The python module did get installed however, which (presumably) gave us the new version_string (2.80) but actually linked to the old 2.79 bpy.so. This is on OSX and as for now we don’t see a way to build the latest OSX version of the bpy.so file. This is unfortunate, but we can work on Linux as well so that’s what we’ll do. I’ve built the 2.81 version succesfully on Linux, so I’ll dev on Linux for now, until the OSX issues are resolved. If I get around to fixing it myself, I’ll post it here.

No problem, hope I could help!

Also, now it’s me who’s having problems. Did you have problems on OpenShadingLanguage compilation? I can’t install deps because of it. I’m going to try out using a different version of C++, and if that doesn’t work, maybe skip that and install it from the Arch package manager, and hope that it works.

sorry I didn’t have any problems with that :wink: this may be due to the fact I was building the blender module though, not sure if it’s needed for that.

1 Like

Yeah, that could be it. No matter, I’ll try to fix it myself. Thanks anyway!

Managed to fix it, I think. Changed the install deps to support the latest version of OSL and OpenImageIO and now it fully builds. Putting this here because it might help someone in the future!