Hello, I am working on moving a Slicer routine from my work computer to the machine it will be deployed on. Unfortunately the machine is headless and my employer has a very sensitive firewall preventing extensions from being simply added with slicer.app.installExtensionFromServer().
In the slicer docs this link is provided for installing from git. I have made the following changes to install from a zipped file instead:
downloadedArchiveFilePath = "/extensions/SlicerExtension-VMTK-master.zip"
outputDir = os.path.join(slicer.app.temporaryPath, "SlicerVMTK")
try:
shutil.rmtree(outputDir)
os.mkdir(outputDir)
except FileNotFoundError:
pass
slicer.util.extractArchive(
archiveFilePath=downloadedArchiveFilePath,
outputDir=outputDir
)
factoryManager = slicer.app.moduleManager().factoryManager()
mod_list = ["ExtractCenterline", "CrossSectionAnalysis"]
for mod in mod_list:
import os # I know this is odd but somehow it says "os not defined" by the second time through the loop if I omit this
modulePath = os.path.join(outputDir, "SlicerExtension-VMTK-master", mod, mod+".py")
factoryManager.registerModule(qt.QFileInfo(modulePath))
factoryManager.loadModules(mod_list)
slicer.util.selectModule("ExtractCenterline")
This all runs fine and as a result I am able to run the lines âimport ExtractCenterlineâ and âimport CrossSectionAnalysisâ. However, when I run the extract centerline logic I am met with the following error:
line 445, in preprocess
import vtkvmtkComputationalGeometryPython as vtkvmtkComputationalGeometry
ModuleNotFoundError: No module named âvtkvmtkComputationalGeometryPythonâ
The only other threads I see on this topic encourage downloading the newest stable release, I am using Slicer 5.4.0 and still encountering this issue. I suspect I am not correctly importing the SlicerVMTK extension because I specifically go after the 2 modules I need, but I donât know how I would get the whole thing as there is no SlicerVMTK.py and I am naively repurposing the example code.
Iâm now able to run Slicer from command and access some extensions without triggering my employerâs firewall, but it only works for simple extensions like AirwaySegmentation or Sandbox. This method still fails for adding SlicerVMTK: Documentation here. It would be nice if someone could point me to the location of the âadditional module pathsâ file so I could just permanently alter it.
What Iâd really like to do is to access the âinstall from fileâ utility from python/cmd line (which is what I thought em.installExtension() would be but it yells at my file path). But at this point if I knew how I would manually copy the correct directories into the extensions section of Slicer and append the necessary info onto slicerâs extension settings files, etc.
Thanks for that example, I was mistakenly using the GitHub repo .zip
Unfortunately I am still having the same problem as before, simple extensions like Sandbox or AirwaySegmentation are successfully installed like this, but I get the following error when rebooting slicer after installing SlicerVMTK:
Error(s):
Cannot load library /home/qiluser/Slicer/slicer.org/Extensions-31938/SlicerVMTK/lib/Slicer-5.4/qt-loadable-modules/libqSlicerStenosisMeasurement3DModule.so: (libvtkSlicerShapeModuleMRML.so: cannot open shared object file: No such file or directory)
libvtkSlicerShapeModuleMRML.so: cannot open shared object file: No such file or directory
libvtkSlicerShapeModuleMRML.so: cannot open shared object file: No such file or directory
libvtkSlicerShapeModuleMRML.so: cannot open shared object file: No such file or directory
Error(s):
CLI executable: /home/qiluser/Slicer/slicer.org/Extensions-31938/SlicerVMTK/lib/Slicer-5.4/qt-loadable-modules/vtkvmtk.py
The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.
Fail to instantiate module âvtkvmtkâ
The following modules failed to be instantiated:
vtkvmtk
When loading module âGuidedArterySegmentationâ , the dependency âSegmentEditorFloodFillingâ failed to be loaded.
When loading module âQuickArterySegmentationâ , the dependency âSegmentEditorFloodFillingâ failed to be loaded.
I am running it like:
em = slicer.app.extensionsManagerModel()
em.interactive = False
em.installExtension(extensionFilePath, True) #installing dependencies
My only guess is my workâs firewall is getting back in the way for retrieving the dependencies. Any way those can be manually installed as well?
Thank you. I am not sure which other dependencies to add at this point. It looks like I have an identical error to this user, which you have already identified as a harmless warning.
However, when I run my script which uses ExtractCenterline and CrossSectionAnalysis, centerline extraction works fine but the line âcross_section_logic.run()â triggers the following:
File â/home/qiluser/Slicer/slicer.org/Extensions-31938/SlicerVMTK/lib/Slicer-5.4/qt-scripted-modules/CrossSectionAnalysis.pyâ, line 871, in run
self.updateOutputTable(self.inputCenterlineNode, self.outputTableNode)
File â/home/qiluser/Slicer/slicer.org/Extensions-31938/SlicerVMTK/lib/Slicer-5.4/qt-scripted-modules/CrossSectionAnalysis.pyâ, line 995, in updateOutputTable
import vtkSlicerCrossSectionAnalysisModuleLogicPython as vtkSlicerCrossSectionAnalysisModuleLogic
ImportError: libvtkSlicerShapeModuleMRML.so: cannot open shared object file: No such file or directory
and I am unable to find anything like âSlicerShapeModuleâ or related to âCrossSectionAnalysisâ as a dependency I could install.
The easiest way to find out all the dependencies (including dependencies of dependencies) is to install the extension on a computer that has network access. If that is not feasible then you get dependencies for an extension from the depends field of its extension description file (.s4ext) in the Extensions Index.