View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002358 | Slicer4 | Core: Extensions | public | 2012-07-26 05:54 | 2012-09-30 04:54 |
Reporter | lassoan | Assigned To | crmullin | ||
Priority | normal | Severity | block | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | |||||
Target Version | Slicer 4.2.0 | Fixed in Version | Slicer 4.2.0 | ||
Summary | 0002358: Python wrapping in extensions fails on Mac | ||||
Description | Python scripts cannot access the wrapped VTK classes that are implemented in extensions on Mac. It works well on Windows and Linux. This causes problems in the SlicerRT and Faceted visualization extensions. | ||||
Tags | No tags attached. | ||||
here is the startup error: Error(s): |
|
Andrey reports that the same happens for the reporting module 7/25/2012 |
|
Probably Jc won't be able to get to this for another month or so - if the issue is more urgent than that, please send a note to the developers list. |
|
Steve, Slicer extension is a delivery mechanism for our QIN Slicer-AIM project. Since the functionality itself is mostly available for testing, this issue effectively prevents Mac users from being able to try it out for a month. Yes, I can ask Mac users to compile Slicer, build extension separately and point it to the build directory. This is not a "minor" issue for us, that's for sure. |
|
Is there any update on this? Does the "=> Slicer 4.2.0 - October 1st 2012" note mean that extensions won't work on Mac till October? This is how we intend to deliver SlicerRT to users, so if it cannot be fixed till October then please suggest a workaround. |
|
Andrey and I tried some debugging on this, but we could not determine why the 'not a valid Qt plugin' failure was being triggered. One thing we decided to try is building a debug-mode installer and extensions to single step through the library loading process. First attempt at this did not work, with error message reported below. It appears that cpack is looking in the wrong directory, since these file have moved from /Developer to /Applications/Xcode.app with more recent versions of Xcode. install_name_tool: input file: /Users/pieper/slicer4/latest/Slicer-superbuild/Slicer-build/_CPack_Packages/macosx-amd64/DragNDrop/Slicer-4.1.0-2012-07-17-macosx-amd64/Slicer.app/Contents/lib/Python/lib/python2.6/distutils/command/wininst-8.0.exe is not a Mach-O file /usr/bin/Rez - SysError 0 during open of "/Developer/Headers/FlatCarbon/*.r".Fatal Error! /usr/bin/Rez - Fatal Error, can't recover./Developer/Headers/FlatCarbon/.r: ### /usr/bin/Rez - Since errors occurred, /Users/pieper/slicer4/latest/Slicer-superbuild/Slicer-build/_CPack_Packages/macosx-amd64/DragNDrop/temp-udco.dmg's resource fork was not completely updated. CPack Error: Problem compressing the directory |
|
Steve, Andras: on Snow Leopard, I was successful in compiling Qt 4.7.4 in debug mode (with the following flags -debug-and-release -opensource -confirm-license -no-qt3support -webkit -arch x86_64 -nomake examples -nomake demos -sdk /Developer/SDKs/MacOSX10.5.sdk), compiling Slicer in Debug mode, packaging it, and reproducing the problem with the packaged extension. I did not have time to investigate the actual cause problem yet. Steve, are you around today/tomorrow to look at this together? I am not sure I will be able to figure out the XCode debugger tricks. |
|
I know of no workaround at this point - the issue is deep inside cpack and only Jc has been working on this part of the build/install process and on extensions. Andrey and I will have a look but so far things have not looked promising. Jc told me he has zero connectivity until August 19th (he's in Central America) |
|
Thanks to a hint from Demian who remembered a similar error message in the designer plugins, I was able to track down an issue in the .dylib files of the Reporting extension. In particular, running otool -L on the dylibs shows they contain entries like this: @executable_path/../Extensions/Reporting/lib/Slicer-4.1/qt-loadable-modules/libvtkSlicerAnnotationsModuleMRML.dylib That is, they are looking for the Annotations dylib inside the Reporting extension file, when those are actually in the base slicer lib directory. By way of a workaround, the following command will fix all the reporting dylib files to point to the correct location of the annotations: for f in this change allows the Reporting module to be detected and to load (hooray!) and it should provide all the needed info for this to be fixed in the extension build scripts. Now that the module is loaded, the next issue is that the python code is not importing so no GUI is built. This should be easier to track down and may be due to the same issue. Traceback (most recent call last): |
|
Apparently the python helper code that is bundled with the extension is not accessible because it is not in a place accessible to the python search path. Adding the following to the top of Extensions/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/qSlicerReportingModuleWidget.py allows the python helper code to be imported: WORKAROUND: until launcher correctly sets paths for module python filesimport sys,os After adding this, the new error is pasted below. This is probably because the module's logic library is not being initialized correctly: Show module (name): "Reporting" Note that when accessing the reporting logic it appears as the generic module superclass, not as a reporting logic:
|
|
Steve, I still have "not a valid Qt plugin" after running the workaround you suggested. |
|
Note that the same path replacement needs to be done on the .so files as well as the .dylib This is the same command as above but with .so replacing .dylib for f in |
|
Now I'm able to load the entire extension module into the mac release build (!!!). Note that I needed to add a second workaround to the start of Extensions/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/qSlicerReportingModuleWidget.py as shown below. Now that the issues have been identified it should be a doable project to work these into the extension packaging scripts - ideally, a cpack expert can be recruited to help with this. WORKAROUND: until launcher correctly sets paths for module python filesimport sys,os WORKAROUND: make sure logic is imported before first use so thatlogic instance will have the correct subclass (not generic vtkSlicerModuleLogic)import vtkSlicerReportingModuleLogic |
|
Andrey and I got things working after changes to the import mechanisms (more workarounds). I paste the diffs here for documentation (again the real fix should be done in the extensions packaging code). These are also included in this branch: [6] Reporting ((b357741...))$ diff Py/DICOMSegmentationPlugin.py ~/Desktop/Slicer-2012-08-02.app/Contents/Extensions/Reporting/lib/Slicer-4.1/qt-scripted-modules/DICOMSegmentationPlugin.py
[7] Reporting ((b357741...))$ diff Py/qSlicerReportingModuleWidget.py ~/Desktop/Slicer-2012-08-02.app/Contents/Extensions/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/qSlicerReportingModuleWidget.py
|
|
Very good news! When do you think you can have the fix in the extension packaging code? Just asking so that we can decide if we should apply this workaround on our modules or wait for the packaging update. |
|
Do I understand correctly that there are 2 issues to fix : I believe for b), qSlicerExtensionsManagerModelPrivate::addExtensionPathToLauncherSettings() is the place where the python paths are set. Concerning a), CMake/SlicerExtensionCPackBundleFixup.cmake.in should be investigated. Looks like the matching pattern if(item MATCHES "@Slicer_QTLOADABLEMODULES_LIB_DIR@/[^/]+\.(so|dylib)$") at line |
|
Yes Julien, I agree - there are two issues. |
|
Concerning a), |
|
Here is a partial fix for the incorrect loading of dependencies located in the base slicer lib: https://github.com/chrismullins/Slicer/commit/d33771aa9893523b20fb003521a9ea96c21b14e3 |
|
Fixed in r20852 |
|
There is no error about the shared libraries, but python error is still there. The extension is still not usable. File "/Applications/Slicer.app/Contents/Extensions/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/qSlicerReportingModuleWidget.py", line 76, in init |
|
Chris> Could you investigate ? It is now possible to load the python module directly given its name ? What the value of the "sys.path", are the path associated with the extensions displayed ? Thanks |
|
On today's nightly, the following problem presents: The "Extensions" directory is not created when Slicer is installed on Mac. Example: otool -L /Applications/Slicer.app/Contents/Reporting/lib/Slicer-4.1/qt-loadable-modules/ libqSlicerReportingModule.dylib But since the Contents/Extensions is not created, the Reporting directory is installed directly into Contents. So Contents/Reporting/<everything> exists, but the extension is trying to look for Contents/Extensions/Reporting/<everything> I didn't recall this being the case before. Simply creating the Extensions directory in the right place will cause Slicer to see it and install the extensions in the correct place. EDIT: Is this note in the wrong place? It seems like a separate issue, but maybe related to one of the recent fixes. |
|
Good catch. I guess there are multiple option to solve that issue: 1) Add some code to check such directory exist if Slicer is executed from a packaged/installed tree. See https://github.com/Slicer/Slicer/blob/master/Base/QTCore/qSlicerCoreApplication.cxx#L268 2) Update the CPack/packaging code so that the directory is created. I guess option 2) will avoid some minimal overhead when Slicer is started. the advantage of option 1) is that Slicer will check that the expected folder exists each time Slicer is started. May be both option could be implemented. |
|
Fixed in r21075 |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2012-07-26 05:54 | lassoan | New Issue | |
2012-07-26 05:54 | lassoan | Status | new => assigned |
2012-07-26 05:54 | lassoan | Assigned To | => jcfr |
2012-07-26 10:16 | pieper | Note Added: 0005260 | |
2012-07-26 10:17 | pieper | Note Added: 0005261 | |
2012-07-29 20:34 | fedorov | Severity | minor => block |
2012-07-31 12:09 | pieper | Note Added: 0005467 | |
2012-07-31 12:19 | fedorov | Note Added: 0005469 | |
2012-08-03 15:25 | pieper | Reproducibility | have not tried => always |
2012-08-03 15:25 | pieper | Target Version | => Slicer 4.2.0 - October 1st 2012 |
2012-08-06 07:22 | lassoan | Note Added: 0005505 | |
2012-08-06 09:31 | pieper | Note Added: 0005507 | |
2012-08-06 09:36 | fedorov | Note Added: 0005508 | |
2012-08-06 09:58 | pieper | Note Added: 0005509 | |
2012-08-06 12:39 | pieper | Note Added: 0005510 | |
2012-08-06 12:57 | pieper | Note Added: 0005511 | |
2012-08-06 12:57 | fedorov | Note Added: 0005512 | |
2012-08-06 13:02 | pieper | Note Added: 0005513 | |
2012-08-06 13:35 | pieper | Note Added: 0005514 | |
2012-08-07 14:25 | pieper | Note Added: 0005521 | |
2012-08-07 14:40 | lassoan | Note Added: 0005522 | |
2012-08-08 06:53 | finetjul | Note Added: 0005524 | |
2012-08-08 07:00 | finetjul | Note Edited: 0005524 | |
2012-08-08 08:28 | finetjul | Note Edited: 0005524 | |
2012-08-08 08:56 | pieper | Note Added: 0005525 | |
2012-08-08 10:25 | finetjul | Note Added: 0005527 | |
2012-08-10 14:16 | crmullin | Note Added: 0005538 | |
2012-08-10 14:36 | crmullin | Relationship added | related to 0002390 |
2012-08-10 14:48 | crmullin | Relationship added | related to 0002391 |
2012-08-10 14:59 | crmullin | Note Edited: 0005538 | |
2012-08-23 15:07 | jcfr | Note Added: 0005771 | |
2012-08-23 15:07 | jcfr | Status | assigned => resolved |
2012-08-23 15:07 | jcfr | Fixed in Version | => Slicer 4.2.0 - Feature freeze Sept 1st 2012 |
2012-08-23 15:07 | jcfr | Resolution | open => fixed |
2012-08-25 05:07 | fedorov | Note Added: 0005787 | |
2012-08-25 05:07 | fedorov | Status | resolved => feedback |
2012-08-25 05:07 | fedorov | Resolution | fixed => reopened |
2012-08-29 13:52 | jcfr | Status | feedback => assigned |
2012-08-29 13:52 | jcfr | Assigned To | jcfr => crmullin |
2012-08-29 13:57 | jcfr | Note Added: 0005865 | |
2012-09-17 09:35 | crmullin | Note Added: 0006112 | |
2012-09-17 09:36 | crmullin | Note Edited: 0006112 | |
2012-09-17 09:37 | crmullin | Note Edited: 0006112 | |
2012-09-17 09:52 | jcfr | Note Added: 0006113 | |
2012-09-28 14:12 | jcfr | Note Added: 0006269 | |
2012-09-28 14:12 | jcfr | Status | assigned => resolved |
2012-09-28 14:12 | jcfr | Resolution | reopened => fixed |
2012-09-30 04:54 | fedorov | Status | resolved => closed |
2012-10-17 14:40 | fedorov | Relationship added | related to 0002660 |