nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.26k stars 233 forks source link

Cannot install Topologic with Sverchok on Blender 2.93 #4135

Closed wassimj closed 3 years ago

wassimj commented 3 years ago

Problem statement

I have upgraded Topologic to work correctly with Blender 2.93. I am able to import Topologic and cppyy from Blender's python 3.92 console. However, when I install the TopologicSverchok add-on, Blender crashes with "Can't Obtain Buffer" and will continue to crash until I manually remove the topologicsverchok add-on from the scripts folder.

Steps to reproduce

  1. Download topologicsverchok from github.com/wassimj
  2. Install the topologicsverchok add-on through preferences
  3. Activate the topologicsverchok add-on

Expected result

Topologic activated

Actual result

2021-05-31 10:39:35,819 [INFO] root: Initializing Sverchok logging. Blender version 2.93.0 Beta, Sverchok version 0.6.0.0
addon_utils.disable: topologicsverchok not disabled
Modules Installed (topologicsverchok) from 'C:\\Users\\wassimj\\OneDrive - Cardiff University\\Topologic Files\\TopologicSverchok\\topologicsverchok.zip' into 'C:\\Users\\wassimj\\AppData\\Roaming\\Blender Foundation\\Blender\\2.93\\scripts\\addons'
2021-05-31 10:40:00,490 [INFO] topologicsverchok: Registered 117 nodes
Can't obtain buffer

==========================================
=============== STACKTRACE ===============
==========================================

================ Thread 0 ================
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!cling::runtime::internal::setValueWithAlloc()
  libCling!CppyyLegacy::TClingMethodInfo::GetMangledName()
  libCling!CppyyLegacy::TCling::MethodInfo_GetMangledName()
  libCoreLegacy!CppyyLegacy::TFunction::TFunction()
  libCoreLegacy!CppyyLegacy::TListOfFunctions::Get()
  libCoreLegacy!CppyyLegacy::TListOfFunctions::Load()
  libCoreLegacy!CppyyLegacy::TROOT::GetListOfGlobalFunctions()
  libcppyy_backend!Cppyy::GetMethodIndicesFromName()
  libcppyy.cp39-win_amd64!CPyCppyy::PyException::operator=()
  python39!PyEval_EvalFrameDefault()
  python39!PyEval_EvalFrameDefault()
  python39!PyFunction_Vectorcall()
  python39!PyOS_URandomNonblock()
  python39!PyEval_GetFuncDesc()
  python39!PyEval_EvalFrameDefault()
  python39!PyCFunction_Call()
  python39!PyFunction_Vectorcall()
  python39!PyOS_URandomNonblock()
  python39!PyEval_GetFuncDesc()
  python39!PyEval_EvalFrameDefault()
  python39!PyEval_EvalFrameDefault()
  python39!PyFunction_Vectorcall()
  python39!PyOS_URandomNonblock()
  python39!PyEval_GetFuncDesc()
  python39!PyEval_EvalFrameDefault()
  python39!PyEval_EvalFrameDefault()
  python39!PyFunction_Vectorcall()
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!??
  blender!PyInit_aud()
  KERNEL32!BaseThreadInitThunk()
  ntdll!RtlUserThreadStart()

Sverchok version

0.6.0.0

zeffii commented 3 years ago

my guess is that there is still a discrepancy between the Python version topologicPY is built around vs Blender python?

zeffii commented 3 years ago

I am able to import Topologic and cppyy from Blender's python 3.92 console

just importing, or indeed deeply introspecting the topologic module from that blender py console?

zeffii commented 3 years ago

" Can't obtain buffer " is emitted directly from here https://github.com/nortikin/sverchok/blob/ca65d1ff281e7f05d0e3e61e41facb5ba4e36237/utils/logging.py#L51-L71

zeffii commented 3 years ago

it might be worth clearing Sverchok's logging mechanism. as a test.

image

wassimj commented 3 years ago

I am able to import Topologic and cppyy from Blender's python 3.92 console

just importing, or indeed deeply introspecting the topologic module from that blender py console?

Fully functional.

Topologic392
wassimj commented 3 years ago

it might be worth clearing Sverchok's logging mechanism. as a test.

image

Tried. Did not make any difference. Still crashes right after registering all 117 nodes.

zeffii commented 3 years ago

ok. can you make a test script that does the following.

then you see if you can add the node:

# execute this from console
bpy.data.node_groups['NodeTree'].nodes.new("YourTopologicNode")

it may seem like quite a bit of code just to load one node, but it will become part of your own test suite.

zeffii commented 3 years ago

this way you can bypass many many sverchok things.

wassimj commented 3 years ago

ok. can you make a test script that does the following.

  • when sverchok is loaded, and active
  • register one topologic node, and add it to the tree

    # execute this from TextEditor    ( Alt + P )
    class YourTopologicNode(....):
      ...... stuf ....
      """
      make a dud / dummy node that doesn't really do anything other than 
      - prove that the topologic module imports OK
      - and can print data
      """
    
    classes = [YourTopologicNode]
    register, unregister = bpy.utils.register_classes_factory(classes)
    
    if __name__ == '__main__':
      register()

then you see if you can add the node:

# execute this from console
bpy.data.node_groups['NodeTree'].nodes.new("YourTopologicNode")

it may seem like quite a bit of code just to load one node, but it will become part of your own test suite.

Yes that all worked perfectly. image

zeffii commented 3 years ago

so the same code (full topologic add-on) continues to work in 2.9.2 unchanged? using the same Sverchok ?

because i could see from your screenshots on twitter that the viewerdraw was from a slightly older revision of Sverchok. (pre: https://github.com/nortikin/sverchok/pull/4077 )

it would be useful to know if there is a version of sverchok that does let you load topologic into Blender 2.9.3. It's certainly possible that I introduced a behaviour recently that is not compatible with the way your addon piggybacks sverchok. My best guess is to try a few older releases.. or even older revisions of master if you find one release works but the next doesn't.

wish I could be more helpful, but sometimes Blender is cryptic about its crash. There is a crash report cmd in the Blender folder along side the .exe ( blender_debug_log.cmd ) which might give some hints . I can't tell if your stacktrace comes from that.

zeffii commented 3 years ago

it would be useful to know

wassimj commented 3 years ago

so the same code (full topologic add-on) continues to work in 2.9.2 unchanged? using the same Sverchok ?

because i could see from your screenshots on twitter that the viewerdraw was from a slightly older revision of Sverchok. (pre: #4077 )

it would be useful to know if there is a version of sverchok that does let you load topologic into Blender 2.9.3. It's certainly possible that I introduced a behaviour recently that is not compatible with the way your addon piggybacks sverchok. My best guess is to try a few older releases.. or even older revisions of master if you find one release works but the next doesn't.

wish I could be more helpful, but sometimes Blender is cryptic about its crash. There is a crash report cmd in the Blender folder along side the .exe ( blender_debug_log.cmd ) which might give some hints . I can't tell if your stacktrace comes from that.

Sorry to be thick, where can I find older builds of sverchok?

zeffii commented 3 years ago

you could use git to checkout various hashes, https://devopscube.com/checkout-clone-specific-git-commit-id-sha/

alternatively each branch is automatically accompanied by a zip download.

but I suggest trying the releases, in reverse order. https://github.com/nortikin/sverchok/tags , this will give a coarser jump between commit ID's (SHA) , and if you find that sverchok loads OK in one release, but not in the next, that's going to show us a tighter window of where the "bug" is introduced.

zeffii commented 3 years ago

the github API (from what i can tell) only exposes the last 30 regular commits , so i can't make a script for you that would list the most recent zips-from-branches in any useful way.

wassimj commented 3 years ago

Sorry to have disturtbed you with this. It turns out that the crash was because I linked to OCCT7.5. Topologic is guranteed to work with OCCT7.4, but thought I could build it with 7.5. The build went fine, but I started getting errors etc. Once I reverted to linking to OCCT7.4 it worked as expected and I can load it with no issues into Blender2.93 with python 3.9.2 and the latest sverchok_master. I need to investigate why Topologic is not working well with OCCT7.5. It worked for a while, but then errors started cropping up. Apologies again for wasting your time.

zeffii commented 3 years ago

you're OK @wassimj . at least you can narrow down where to look for solutions.