0
>>> import matplotlib.pyplot as plt
objc[19151]: Class TKApplication is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab188) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e0e40). One of the two will be used. Which one is undefined.
objc[19151]: Class TKMenu is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab1d8) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e2020). One of the two will be used. Which one is undefined.
objc[19151]: Class TKContentView is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab228) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e28a0). One of the two will be used. Which one is undefined.
objc[19151]: Class TKWindow is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab278) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e2da0). One of the two will be used. Which one is undefined.

How do I fix this error when I import matplotlib. I am using python 2.7.12 on Mac Os X (Sierra)

user308827
  • 21,227
  • 87
  • 254
  • 417
  • You have an issue with your `tk` installation, where `tk` is double installed. Remove one of the `tk` installations and it should work. – Eli Sadoff Oct 19 '16 at 01:29
  • This is a common error when installing Anaconda over an already existing python install. – Eli Sadoff Oct 19 '16 at 01:30
  • thanks @Eli, I added a backend TkAgg in my .matplotlibrc file, should I change that to something else? – user308827 Oct 19 '16 at 01:42
  • Did you look at: http://stackoverflow.com/questions/35593602/tk-framework-double-implementation-issue or similar questions (Googling *"Class TKApplication is implemented"* gives lots of similar results)? What have you tried so far? Did you try Eli's suggestion? – Bart Oct 21 '16 at 09:45
  • @Bart this link not include a answer ! `sys.modules` returned two `Tk` library , he got a lot missing point, `python shell` used `default Tkinter` but he call `Tkinter` from another module. Terminal-Python Idle are different things. Don't use python-idle check output which Tk directory related to `matplotlib` (on terminal)? Never delete a duplicate module, maybe include another module(terrible idea). `import sys ; remove some duplicate module name on namespace` – dsgdfg Oct 24 '16 at 05:53

1 Answers1

0

As noted in comments, Python can't decide what tk version to use. Is your plan to use the anaconda environment? If you have no reason for using the anaconda version, I would just remove it and go with the system one.

rm /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib
pingul
  • 3,351
  • 3
  • 25
  • 43