Community
cancel
Showing results for 
Search instead for 
Did you mean: 
latorre__fabian
Beginner
650 Views

RunTimeError tkinter 8.6 in osx 10.13

osx 10.13.1

Reproducible example (Using Python 3.6.3 |Intel Corporation| (default, Oct 16 2017, 10:30:26))

import tkinter
tkinter._test()

Result

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/intel/intelpython3/lib/python3.6/tkinter/__init__.py", line 3982, in _test
    root = Tk()
  File "/opt/intel/intelpython3/lib/python3.6/tkinter/__init__.py", line 2019, in __init__
    self._loadtk()
  File "/opt/intel/intelpython3/lib/python3.6/tkinter/__init__.py", line 2034, in _loadtk
    % (_tkinter.TK_VERSION, tk_version))
RuntimeError: tk.h version (8.6) doesn't match libtk.a version (8.5)

I tried installing tk 8.6 but the error persists. I have the following folders

/System/Library/Frameworks/Tk.framework/Versions/8.5

/Library/Frameworks/Tk.framework/Versions/8.6

This was causing matplotlib to not function properly, my temporary solution was to add the following line

matplotlib.use('Qt5Agg')

Other Python distributions in my computer work ok with Tk 8.5

0 Kudos
5 Replies
650 Views

Hi Fabian,

Intel Python includes its own copy of Tk in /opt/intel/intelpython3/lib, so there must be something in your environment that's preferring the system Tk. Can you try unsetting environment variables like DYLD_LIBRARY_PATH? Also you can run `env | grep Tk` to see if anything in your environment is pointing to the system Tk.  To debug the library loading, you can set DYLD_PRINT_LIBRARIES. As a last resort, `export DYLD_LIBRARY_PATH=/opt/intel/intelpython3/lib` would likely work around the error.

Please let me know what you discover.

Chris

latorre__fabian
Beginner
650 Views

Hi CHris thanks for the help

1. Unsetting DYLD_LIBRARY_PATH: Same error

2. env | grep Tk: No results

3. set DYLD_PRINT_LIBRARIES: Same error

4. export DYLD_LIBRARY_PATH=/opt/intel/intelpython3/lib: Different error shows

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/intel/intelpython3/lib/python3.6/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: dlopen(/opt/intel/intelpython3/lib/python3.6/lib-dynload/_tkinter.cpython-36m-darwin.so, 2): Symbol not found: __cg_png_create_info_struct
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/intel/intelpython3/lib/libPng.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO

Note I have the file /opt/intel/intelpython3/lib/libpng.dylib (Without the capital P as in the error)

 

Darren_Bane
Beginner
650 Views

Just a note to say that I can reproduce this too. Exact same behaviour on macOS 10.13.3 & Intel Python 2018 Update 1. I ran "conda update --all" but it didn't help. I also tried creating symlinks from wish and tclsh to wish8.6 and tclsh8.6 respectively in the bin directory, but that didn't help either. And running

import tkinter
tkinter.Tcl().eval('info patchlevel')

outputs

'8.5.9'

which is the Apple version.

Are there any plans to fix it?

Mshira
Beginner
650 Views

Hi, all. I also had a same problem on macOS 10.13.3. Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 16 2017, 10:30:26) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin Type "help", "copyright", "credits" or "license" for more information. Intel(R) Distribution for Python is brought to you by Intel Corporation. Please check out: https://software.intel.com/en-us/python-distribution >>> import tkinter >>> tkinter._test() Traceback (most recent call last): File "", line 1, in File "/Users/USERNAME/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/tkinter/__init__.py", line 3982, in _test root = Tk() File "/Users/USERNAME/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/tkinter/__init__.py", line 2019, in __init__ self._loadtk() File "/Users/USERNAME/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/tkinter/__init__.py", line 2034, in _loadtk % (_tkinter.TK_VERSION, tk_version)) RuntimeError: tk.h version (8.6) doesn't match libtk.a version (8.5) I hope if we could find good solution.
Darren_Bane
Beginner
650 Views

After running "conda update --all" tkinter works fine now. I presume it was the update of one of the "intelpython", "tcl" or "tk" packages in the past few days/weeks. Thanks for fixing it.

Reply