Issue while Importing .pyd module

I’ve been working on an add-on Involving the pyopenvdb module and decided to switch to 2.91 for the actual add-on stuff because the reload scripts function in 2.90 was broken. When I tried to import the module It gave me a ImportError: DLL load failed: The specified procedure could not be found.. The same file works on 2.90 and since the two versions use the exact same python version that shouldn’t be an issue. I’ve done a bit of research and apparently sys.executable has changed. I don’t know if that’s the issue and if so how to resolve it. Did anyone else come across similar problems?

we started shipping openvdb as a shared library (dll), while it was previously statically linked (blender.exe contained it), so if you shipped an openvdb.dll of your own with your pyopenvdb python module you may run into issues with those dll’s being of different versions.

That might be it. Where can I check the version that ships with blender? And is there a way to force python to use my own module?

Shouldn’t the pyopenvdb.pyd file that I import just use the files in the same folder since it also works without blender in a normal python console? Or are there some things that I don’t understand about how blender works with imported modules?
image
These are the files I put int the modules folder

You can only load a shared library once, so if blenders copy of openvdb.dll gets loaded first, you cannot load another copy of the dll form a different folder.

We currently ship 7.0.0

You really ought not to ship that python37.dll and tbb.dll blender since already ships those

Ah, so that probably is the issue. I built pyopenvdb with an older version to be able to run it with python 3.7. Is there a workaround or maybe a plan for adding pyopenvdb natively to blender?

the change to ship the shared openvdb.dll was in preparation for being able to ship pyopenvdb with blender if we wanted to. However i’m not aware of any work / plans in this area to actually make that happen.

That’s unfortunate, I will finish it in 2.90 then and hope that we get native pyopenvdb support soon.
Thanks anyways

@LazyDodo Any news on this front? I’ve managed to build pyopenvdb 8.0.0 but I can’t get imported it in Blender 2.93. I get exactly the same error as @JYoshi. Event though Python and OpenVDB versions match what system info reports.

afaik no-one is working on this at this moment.

Hey, thanks for replying. My question is, is this possible at all ATM? I’ve only managed to get a different error by adding the boost dll my pyopenvdb.pyd requires. It now throws a MemoryError. If I leave the pyd alone, it fails to load the module even if it’s compiled with the same OpenVDB and Python from Blender.

I’d expect this to work, but can’t say i have tried in recent times.

@LazyDodo how big of an effort would you estimate it to be to finish that work on making pyopenvdb work/ship with blender?

Unsure, I’m just the platform guy making sure things build, actual integration would be done by the render team, @brecht would be in a better position to give any insights into how much time this would take and where it fits in their planning.

It’s not a priority right now, there’s no specific date. Might be a week or two of work for a developer that knows the relevant code.

1 Like