ImportError with Uniform Remesh

Every time I try to use Uniform Remesh in the Surface Toolbox, I get this error:

[Python] Failed to compute output model: DLL load failed while importing _clustering: The specified module could not be found.
Traceback (most recent call last):
File “C:/Users/kucerabi/Desktop/Slicer 5.6.2/bin/…/lib/Slicer-5.6/qt-scripted-modules/SurfaceToolbox.py”, line 278, in onApplyButton
self.logic.applyFilters(self.parameterNode)
File “C:/Users/kucerabi/Desktop/Slicer 5.6.2/bin/…/lib/Slicer-5.6/qt-scripted-modules/SurfaceToolbox.py”, line 579, in applyFilters
SurfaceToolboxLogic.remesh(outputModel, outputModel,
File “C:/Users/kucerabi/Desktop/Slicer 5.6.2/bin/…/lib/Slicer-5.6/qt-scripted-modules/SurfaceToolbox.py”, line 404, in remesh
if not SurfaceToolboxLogic.installRemeshPrerequisites():
File “C:/Users/kucerabi/Desktop/Slicer 5.6.2/bin/…/lib/Slicer-5.6/qt-scripted-modules/SurfaceToolbox.py”, line 387, in installRemeshPrerequisites
import pyacvd
File "C:\Users\kucerabi\Desktop\Slicer 5.6.2\lib\Python\Lib\site-packages\pyacvd_init
.py", line 3, in
from pyacvd.clustering import Clustering
File “C:\Users\kucerabi\Desktop\Slicer 5.6.2\lib\Python\Lib\site-packages\pyacvd\clustering.py”, line 16, in
from pyacvd import _clustering
ImportError: DLL load failed while importing _clustering: The specified module could not be found.

Why am I getting this? What can I do to resolve it?

Thank you!

Looks like remeshing python package didn’t install for some reason. Try installing manually and see if you are getting an error
pip_install("pyacvd")

Unfortunately, pyacvd developers broke their package in their 0.3.0 version by adding C code that needs to be compiled and it is only compatible with VTK hosted on PyPI. I’ve submitted an issue to their tracker, but since probably they will not fix this for a long time, I’ll add a version restriction to only use pyacvd<0.3.

In the meantime, you can fix the issue by executing slicer.util.pip_install("pyacvd<0.3") in the Slicer Python console.

2 Likes

I’ve tested this a bit more and on my computer on a fresh Slicer-5.6.2 installation everything works.

Could you please check if this file exists on your computer?

C:\Users\kucerabi\Desktop\Slicer 5.6.2\lib\Python\Lib\site-packages\pyacvd_clustering.cp39-win_amd64.pyd

Maybe you have some third-party antivirus software installed that removes binaries that it does not like.

1 Like

@kucerabi have you had a chance to check if the .pyd file exists on your computer?

1 Like

I have the .pyd file on my computer, but it still wouldn’t run. However, slicer.util.pip_install(“pyacvd<0.3”) resolved the issue.

Thank you!

Thank you, this information is very useful. I’ve noticed a difference between pyacvd-0.2 and pyacvd-0.3: the .pyd file in the more recent version uses OpenMP.

To test if this is indeed causing the incompatibility of pyacvd-0.3 with your computer, would you mind do these steps:
-install pyacvd-0.3.0 by runnning this in the Slicer Python console: pip_install('pyacvd==0.3.0')
-download libomp140.x86_64.dll library (if you want to learn more about this file, see [1] or [2])
-copy the downloaded libomp140.x86_64.dll to the folder: C:\Users\kucerabi\Desktop\Slicer 5.6.2\lib\Python\Lib\site-packages\pyacvd\
-test if uniform remeshing works and let us know here!

The developer of pyacvd will remove OpenMP dependency from pyacvd, so you can also just wait for a few days and test with the latest pyacvd version.

A new version of pyacvd is ready that does not depend on OpenMP. Please try if it works:

pip_install("pyacvd==0.3.1")