Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install Topologic with Sverchok on Blender 2.93 #4135

Closed
wassimj opened this issue May 31, 2021 · 16 comments
Closed

Cannot install Topologic with Sverchok on Blender 2.93 #4135

wassimj opened this issue May 31, 2021 · 16 comments

Comments

@wassimj
Copy link

wassimj commented May 31, 2021

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
Copy link
Collaborator

zeffii commented May 31, 2021

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

@zeffii
Copy link
Collaborator

zeffii commented May 31, 2021

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
Copy link
Collaborator

zeffii commented May 31, 2021

" Can't obtain buffer "
is emitted directly from here

def emit(self, record):
"""
Emit a record.
If a formatter is specified, it is used to format the record.
The record is then written to the buffer with a trailing newline. If
exception information is present, it is formatted using
traceback.print_exception and appended to the stream. If the stream
has an 'encoding' attribute, it is used to determine how to do the
output to the stream.
"""
try:
msg = self.format(record)
stream = get_log_buffer(self.buffer_name)
if not stream:
print("Can't obtain buffer")
return
stream.write(msg)
stream.write(self.terminator)
self.flush()
except Exception:
self.handleError(record)

@zeffii
Copy link
Collaborator

zeffii commented May 31, 2021

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

image

@wassimj
Copy link
Author

wassimj commented May 31, 2021

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
Copy link
Author

wassimj commented May 31, 2021

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
Copy link
Collaborator

zeffii commented May 31, 2021

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.

@zeffii
Copy link
Collaborator

zeffii commented May 31, 2021

this way you can bypass many many sverchok things.

@wassimj
Copy link
Author

wassimj commented Jun 1, 2021

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
Copy link
Collaborator

zeffii commented Jun 1, 2021

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.

@zeffii
Copy link
Collaborator

zeffii commented Jun 1, 2021

it would be useful to know

  • if the latest Sverchok also doesn't load topologic correctly in 2.92
  • if there is a version (release, or branch) of sverchok that that does load topologic correctly in Blender 2.9.3

@wassimj
Copy link
Author

wassimj commented Jun 1, 2021

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
Copy link
Collaborator

zeffii commented Jun 1, 2021

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.
- go to https://github.com/nortikin/sverchok/commits/master
- for example pick a commit
image
- then click on the origin
image
- then click the code dropdown for the zip
image

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
Copy link
Collaborator

zeffii commented Jun 1, 2021

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
Copy link
Author

wassimj commented Jun 1, 2021

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.

@wassimj wassimj closed this as completed Jun 1, 2021
@zeffii
Copy link
Collaborator

zeffii commented Jun 1, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants