View Issue Details

IDProjectCategoryView StatusLast Update
0003065Slicer4Core: Base Codepublic2017-06-07 23:27
Reporterpohl Assigned Tojcfr  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformMACOSRon's MachineOS VersionN/A
Product Version 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.3.0 
Summary0003065: ImportError: No module named Tkinter
Description

Running a task in the EMSegmenter the following happens

 [EMSegmentPy 04/11/2013 13:29:14]: Loading completed.
GetTclTaskDirectory::Copying task files ...
    from: /Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/share/Slicer-4.2/qt-loadable-modules/EMSegment/Tasks
    to: /var/folders/13/ctgvj7r144vgzlpl_11k_wfr0000gp/T/Slicer/EMSegmentTaskCopy
goToNextStepAfterSuccessfulValidation - Calidation succeeded
goToNextStepAfterSuccessfulValidation - Posting TransitionToNextStep
performTransitionBetweenSteps - Performing transition between steps
onExitInternal - exiting 1. Define Task
onEntryInternal - entering input from 2. Define Input Datasets
processingAfterOnEntry
updateClientArea - hiding 1. Define Task
showUserInterface - showing 2. Define Input Datasets
GetTclTaskDirectory::Copying task files ...
    from: /Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/share/Slicer-4.2/qt-loadable-modules/EMSegment/Tasks
    to: /var/folders/13/ctgvj7r144vgzlpl_11k_wfr0000gp/T/Slicer/EMSegmentTaskCopy
Sourcing task general file: /var/folders/13/ctgvj7r144vgzlpl_11k_wfr0000gp/T/Slicer/EMSegmentTaskCopy/GenericTask.tcl
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/slicer/slicerqt-with-tcl.py", line 12, in tcl
    import tpycl
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/__init__.py", line 1, in <module>
    from tpycl import *
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/tpycl.py", line 12, in <module>
    import Tkinter
ImportError: No module named Tkinter
GetTclTaskDirectory::Copying task files ...
    from: /Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/share/Slicer-4.2/qt-loadable-modules/EMSegment/Tasks
    to: /var/folders/13/ctgvj7r144vgzlpl_11k_wfr0000gp/T/Slicer/EMSegmentTaskCopy
Sourcing task specific file: /var/folders/13/ctgvj7r144vgzlpl_11k_wfr0000gp/T/Slicer/EMSegmentTaskCopy/MRI-Human-Brain.tcl
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/slicer/slicerqt-with-tcl.py", line 12, in tcl
    import tpycl
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/__init__.py", line 1, in <module>
    from tpycl import *
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/tpycl.py", line 12, in <module>
    import Tkinter
ImportError: No module named Tkinter
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/slicer/slicerqt-with-tcl.py", line 12, in tcl
    import tpycl
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/__init__.py", line 1, in <module>
    from tpycl import *
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/tpycl.py", line 12, in <module>
    import Tkinter
ImportError: No module named Tkinter
Traceback (most recent call last):
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/lib/Slicer-4.2/qt-loadable-modules/Python/EMSegmentWizard/EMSegmentDefineInputChannelsStep.py", line 154, in onEntry
    tcl( '::EMSegmenterSimpleTcl::ShowCheckList ' + str( logicTclName ) )
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/slicer/slicerqt-with-tcl.py", line 12, in tcl
    import tpycl
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/__init__.py", line 1, in <module>
    from tpycl import *
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/tpycl.py", line 12, in <module>
    import Tkinter
ImportError: No module named Tkinter
goToStep - Attempting to go to finish step Segment
goForward - posting ValidationTransition
attemptToGoToNextStep - Attempting to go to the next step
validateInternal - validating input from 2. Define Input Datasets
goToNextStepAfterSuccessfulValidation - Calidation succeeded
goToNextStepAfterSuccessfulValidation - Posting TransitionToNextStep
performTransitionBetweenSteps - Performing transition between steps
onExitInternal - exiting 2. Define Input Datasets
Traceback (most recent call last):
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/lib/Slicer-4.2/qt-loadable-modules/Python/EMSegmentWizard/EMSegmentDefineInputChannelsStep.py", line 167, in onExit
    returnValue = tcl( "::EMSegmenterSimpleTcl::ValidateCheckList" )
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/slicer/slicerqt-with-tcl.py", line 12, in tcl
    import tpycl
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/__init__.py", line 1, in <module>
    from tpycl import *
  File "/Users/rkikinis/Downloads/Slicer-4.2.0-2013-04-09-macosx-amd64.app/Contents/bin/Python/tpycl/tpycl.py", line 12, in <module>
    import Tkinter
ImportError: No module named Tkinter
Additional Information

Probably a side effect of the migration to CMake'ified python.
I was able to reproduce the problem. Travelling this weekend, will be addressing this next week.
Make sure to create an issue and assigned it to me.
Thanks
Jc

TagsNo tags attached.

Activities

jcfr

jcfr

2013-04-15 10:45

administrator   ~0008399

Last edited: 2013-04-15 11:25

It turns out that the python extension are not properly fixed up. As illustrated below, the path is:

@executable_path/../../Contents/MacOS/<PythonExtension>.so

whereas it should be:

@executable_path/../../Contents/lib/Python/lib/python2.7/lib-dynload/<PythonExtension>.so

Output of otool:

factory-south:lib-dynload kitware$ otool -L _tkinter.so
_tkinter.so:
@executable_path/../../Contents/MacOS/_tkinter.so (compatibility version 0.0.0, current version 0.0.0)
@executable_path/../lib/TclTk/lib/libtcl8.4.dylib (compatibility version 8.4.0, current version 8.4.19)
@executable_path/../lib/TclTk/lib/libtk8.4.dylib (compatibility version 8.4.0, current version 8.4.19)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
factory-south:lib-dynload kitware$ otool -L _csv.so
_csv.so:
@executable_path/../../Contents/MacOS/_csv.so (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

jcfr

jcfr

2013-04-16 07:07

administrator   ~0008403

While it could be problematic not to have properly fixed up extension, this is a different issue but not the source of the current problem.

The problem was that the "lib-tk" path wasn't appended to the PYTHONPATH definition while compiling getpath.c (unix) or getpathp.c (windows)

Topic "add-lib-tk-to-pythonpath" should fix the issue and is currently being tested.
See https://github.com/davidsansome/python-cmake-buildsystem/commit/60ee8280184b5c2ace915777193f457df57f605a

jcfr

jcfr

2013-04-16 07:08

administrator   ~0008404

Last edited: 2013-04-16 07:08

Topic fixed tcl test associate with CMake'ified python. See http://open.cdash.org/buildSummary.php?buildid=2877484

Local build of slicer including the change allow to import Tkinter :) External_python.cmake will be updated soon.

jcfr

jcfr

2013-04-16 09:12

administrator   ~0008407

Fixed in r21891
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&amp;revision=21891

jcfr

jcfr

2014-03-06 04:53

administrator   ~0010783

Closing resolved issues that have not been updated in more than 3 months

jcfr

jcfr

2017-06-07 23:27

administrator   ~0014649

Fix committed to 2145-support-for-installing-extension-from-file branch.

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file 9d396cb1

2013-04-16 13:09:03

jcfr

Details Diff
BUG: Fix import of Tkinter and Fix compilation errors on VS 2010 and 2012

Updated CMake'ified python external project to include the following
topics:
* 60ee828 - Merge branch 'add-lib-tk-to-pythonpath'
* 8a3c51a - Merge branch '8-add-ctestconfig'
* 22a0870 - Merge branch 'fix-msvc2012-build-error'
* a70729f - Merge branch 'fix-msvc2012-link-error'

See https://github.com/davidsansome/python-cmake-buildsystem/pull/13
Fixes python-cmake-buildsystem issue 13

See http://www.na-mic.org/Bug/view.php?id=3065
Fixes 0003065

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21891 3bd1e089-480b-0410-8dfb-8563597acbee
mod - SuperBuild/External_python.cmake Diff File

Issue History

Date Modified Username Field Change
2013-04-13 07:56 pohl New Issue
2013-04-13 07:56 pohl Status new => assigned
2013-04-13 07:56 pohl Assigned To => jcfr
2013-04-15 10:45 jcfr Note Added: 0008399
2013-04-15 11:13 jcfr Note Edited: 0008399
2013-04-15 11:25 jcfr Note Edited: 0008399
2013-04-16 07:07 jcfr Note Added: 0008403
2013-04-16 07:08 jcfr Note Added: 0008404
2013-04-16 07:08 jcfr Note Edited: 0008404
2013-04-16 09:12 jcfr Note Added: 0008407
2013-04-16 09:12 jcfr Status assigned => resolved
2013-04-16 09:12 jcfr Fixed in Version => Slicer 4.3.0
2013-04-16 09:12 jcfr Resolution open => fixed
2013-04-16 09:12 jcfr Target Version => Slicer 4.3.0
2014-03-06 04:53 jcfr Note Added: 0010783
2014-03-06 04:54 jcfr Status resolved => closed
2017-06-07 23:27 jcfr Changeset attached => Slicer 2145-support-for-installing-extension-from-file 9d396cb1
2017-06-07 23:27 jcfr Note Added: 0014649