pieper / CustomSlicerGenerator

Tool to help deploy custom applications
1 stars 7 forks source link

BUG: libraries of python wrapping of C++ modules not loaded #9

Closed Punzo closed 7 years ago

Punzo commented 7 years ago

Hi @pieper, I am trying to make an executable of SlicerAstro (donwloaded the nightly binaries and installed my extension from the extension manager). However, when I run the new binary I get this:

No module named vtkSlicerAstroVolumeModuleLogicPython No module named vtkSlicerAstroSmoothingModuleLogicPython No module named vtkSlicerAstroModelingModuleLogicPython No module named vtkSlicerAstroVolumeModuleMRMLPython No module named qSlicerAstroVolumeModuleWidgetsPythonQt No module named qSlicerAstroVolumeEditorEffectsPythonQt

everything seems ok; for example the SlicerAstro libraries are all copied properly in the final customized binary folder.

Is there something that I am skypping?

This is my json file:

{ "TargetAppName": "SlicerAstro", "WelcomeMessage": "This project was supported by the European Research Council under the European Union's Seventh Framework Programme (FP/2007-2013)/ERC Grant Agreement nr. 291-531.", "Version": "-Betha", "RequiredExtensions": ["SlicerAstro"], "ModulesToKeep": [ "Annotations", "Cameras", "Colors", "Data", "DataProbe", "DataStore", "Markups", "Reformat", "SceneViews", "ScreenShots", "ScreenCapture", "SegmentEditor", "Segmentations", "SubjectHierarchy", "Tables", "Terminologies", "Transforms", "Units", "VolumeRendering", "VolumesModule", "WelcometoSlicer" ], "ModulesToSkip": [ "Test.py", "CreateDICOMSeries", "DICOM2FullBrainTractography", "DICOMLib", "DICOMPlugin", "DICOMSlicerDataBundlePlugin.py", "DICOMSlicerDataBundlePlugin" ] }

Punzo commented 7 years ago

P.S.: running on ubuntu17.04

Punzo commented 7 years ago

copying the libraries in the folder SlicerAstro-Betha/lib/Slicer-4.7/qt-loadable-modules instead of SlicerAstro-Betha/SlicerAstro-Betha-Extensions/SlicerAstro/lib/Slicer-4.7/qt-loadable-modules

seems to fix the issue

pieper commented 7 years ago

Hi @Punzo - Interesting - as I recall we tried to keep the extension paths consistent with the way they would be installed in the main slicer application, only changing the name of the application and then providing the custom config script.

Maybe you can send a pointer to the package I could have a look at the configuration?

Also @fbudin69500 may have some ideas.

fbudin69500 commented 7 years ago

@Punzo Glad to see you are still working on SlicerAstro! I don't think I ever tried to create a custom Slicer that contained a loadable module. All the extensions that I was installing were either Python or CLIs.

pieper commented 7 years ago

Thanks @fbudin69500 we maybe are just missing a line in the launcher settings to handle loadable module paths.

fbudin69500 commented 7 years ago

Yes. When installing a Slicer extension, some paths are added to ~/.config/NA-MIC/Slicer-xxxxx.ini (or wherever that file is depending on the machine) and these paths need to be added somewhere. The easiest is probably to add them to the launcher settings (after copying that file). One hackish solution would be to automatically move dynamic libraries directly into the customize Slicer library path (which is what @Punzo did manually).

pieper commented 7 years ago

I think if I just look at Davide's custom slicer I'll get a good idea what needs to be fixed in the script.

On Tue, Jun 6, 2017 at 1:41 PM, Francois Budin notifications@github.com wrote:

Yes. When installing a Slicer extension, some paths are added to ~/.config/NA-MIC/Slicer-xxxxx.ini (or wherever that file is depending on the machine) and these paths need to be added somewhere. The easiest is probably to add them to the launcher settings (after copying that file). One hackish solution would be to automatically move dynamic libraries directly into the customize Slicer library path (which is what @Punzo https://github.com/punzo did manually).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pieper/CustomSlicerGenerator/issues/9#issuecomment-306562724, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHsfebsv267wBz3SiHchjZQAW4sKheIks5sBY9kgaJpZM4NxDyT .

Punzo commented 7 years ago

Hi @fbudin69500, yes I'll work for another year on it (:

@pieper I'll send this afternoon a link with it (tar.gz file)

Punzo commented 7 years ago

@pieper here is : https://www.dropbox.com/s/xygps3dhghf75kb/SlicerAstroBinary.tar.gz?dl=0

and log: https://www.dropbox.com/s/62fsmuvxqj9b9ge/SlicerAstro-Betha.log.txt?dl=0

pieper commented 7 years ago

Interesting - another way to fix this is to add the loadable module directory to the PYTHON path before starting SlicerAstro, as in the line below.

PYTHONPATH=/tmp/SlicerAstro-Betha/SlicerAstro-Betha-Extensions/SlicerAstro/lib/Slicer-4.7/qt-loadable-modules ./SlicerAstro-Betha/SlicerAstro-Betha

Apparently the launcher is not setting this PYTHONPATH for the Customized Slicer's extension layout, but it must be setting it to something valid when the regular SlicerAstro extension is installed in the regular Slicer. As far as I could tell the configurations of the Additional Module Paths look the same.

I looked for a while but didn't see what the issue could be.

Punzo commented 7 years ago

Hi Steve, thanks for looking into it. I agree that the paths are set properly. In fact, the loadable modules work. It is only the python wrappings of such modules that are not found. Maybe @fbudin69500 or @jcfr know how this is handled in the Extension manager?

pieper commented 7 years ago

Hi Davide, Francois -

I installed a slicer nightly and added SlicerAstro extension and found that the config files are different as shown below - this confirms it's the LibraryPaths and PYTHONPATH are different.

I was able to patch this on my local version of SlicerAstro-Betha using the lines in this PR:

https://github.com/pieper/CustomSlicerGenerator/pull/11

@Punzo can you test?

-Steve

pieper@u:~/slicer4/latest/Slicer-superbuild$ diff  ~/.config/NA-MIC/Slicer-26072.ini ~/.config/NA-MIC/SlicerAstro-Betha-26062.ini 
3,5c3,4
< 000=/tmp/Slicer/Slicer_26072_20170609_103106.log
< 001=/tmp/Slicer/Slicer_26072_20170609_103042.log
< 002=/tmp/Slicer/Slicer_26072_20170609_102353.log
---
> 000=/tmp/SlicerAstro-Betha/Slicer_26062_20170609_102751.log
> 001=/tmp/SlicerAstro-Betha/Slicer_26062_20170609_102740.log
8c7
< AdditionalPaths=/home/pieper/.config/NA-MIC/Extensions-26072/SlicerAstro/lib/Slicer-4.7/qt-loadable-modules, /home/pieper/.config/NA-MIC/Extensions-26072/SlicerAstro/lib/Slicer-4.7/qt-scripted-modules
---
> AdditionalPaths=/tmp/SlicerAstro-Betha/SlicerAstro-Betha-Extensions/SlicerAstro/lib/Slicer-4.7/qt-loadable-modules, /tmp/SlicerAstro-Betha/SlicerAstro-Betha-Extensions/SlicerAstro/lib/Slicer-4.7/qt-scripted-modules
12c11
< ManagerEnabled=true
---
> ManagerEnabled=false
14c13
< InstallPath=/home/pieper/.config/NA-MIC/Extensions-26072
---
> InstallPath=/tmp/SlicerAstro-Betha/Extensions-26062
65,77d63
< 
< [LibraryPaths]
< 1\path=/home/pieper/.config/NA-MIC/Extensions-26072/SlicerAstro/lib/Slicer-4.7
< 2\path=/home/pieper/.config/NA-MIC/Extensions-26072/SlicerAstro/lib/Slicer-4.7/qt-loadable-modules
< 3\path=/home/pieper/.config/NA-MIC/Extensions-26072/SlicerAstro/lib/Slicer-4.7
< size=3
< 
< [Paths]
< size=0
< 
< [PYTHONPATH]
< 1\path=/home/pieper/.config/NA-MIC/Extensions-26072/SlicerAstro/lib/Slicer-4.7/qt-scripted-modules
< size=1
Punzo commented 7 years ago

Hi @pieper tested and works! Thanks!