Matplotlib can be tricky.

In my tutorials that use matplotlib, you'll notice the following line:

  matplotlib.use('TKAgg')

This specifies what matplotlib "backend" to use, and "TKAgg" requires
Tkinter. You could try using other backends that don't. I don't know
much about this, but you can read more here:
http://matplotlib.org/faq/usage_faq.html#what-is-a-backend. It
contains a list of other backends you might try.
---------
Matt Taylor
OS Community Flag-Bearer
Numenta


On Wed, Jul 30, 2014 at 9:13 PM, Mika Schiller <[email protected]> wrote:
>> Hello,
>
>
> I am running Macports python 2.7 with the most recent versions of Tkinter
> and matplotlib. When I try to plot the hotgym data by running the command
> line "python run.py --plot", I get the following error:
>
> objc[13058]: Class TKApplication is implemented in both
> /opt/local/lib/libtk8.6.dylib and
> /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will
> be used. Which one is undefined.
>
> objc[13058]: Class TKMenu is implemented in both
> /opt/local/lib/libtk8.6.dylib and
> /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will
> be used. Which one is undefined.
>
> objc[13058]: Class TKContentView is implemented in both
> /opt/local/lib/libtk8.6.dylib and
> /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will
> be used. Which one is undefined.
>
> objc[13058]: Class TKWindow is implemented in both
> /opt/local/lib/libtk8.6.dylib and
> /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will
> be used. Which one is undefined.
>
> Starts a NuPIC model from the model params returned by the swarm
>
> and pushes each line of input from the gym into the model. Results
>
> are written to an output file (default) or plotted dynamically if
>
> the --plot option is specified.
>
> NOTE: You must run ./swarm.py before this, because model parameters
>
> are required to run NuPIC.
>
>
> Creating model from rec-center-hourly...
>
> Importing model params from model_params
>
> Exception in Tkinter callback
>
> Traceback (most recent call last):
>
>   File
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py",
> line 1470, in __call__
>
>     return self.func(*args)
>
>   File
> "/Library/Python/2.7/site-packages/matplotlib/backends/backend_tkagg.py",
> line 276, in resize
>
>     self.show()
>
>   File
> "/Library/Python/2.7/site-packages/matplotlib/backends/backend_tkagg.py",
> line 349, in draw
>
>     tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
>
>   File "/Library/Python/2.7/site-packages/matplotlib/backends/tkagg.py",
> line 20, in blit
>
>     tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
> id(bbox_array))
>
> TclError
>
> initializing rec-center-hourly
>
> Traceback (most recent call last):
>
>   File "run.py", line 123, in <module>
>
>     runModel(GYM_NAME, plot=plot)
>
>   File "run.py", line 113, in runModel
>
>     runIoThroughNupic(inputData, model, gymName, plot)
>
>   File "run.py", line 102, in runIoThroughNupic
>
>     output.write([timestamp], [consumption], [prediction])
>
>   File
> "/Users/mikaschiller/Desktop/Python_Practice_Code/Learn_Python_the_Hard_Way/projects/skeleton/nodemotiondev/nupic/examples/opf/clients/hotgym/prediction/one_gym/swarm/model_0/nupic_output.py",
> line 186, in write
>
>     plt.draw()
>
>   File "/Library/Python/2.7/site-packages/matplotlib/pyplot.py", line 555,
> in draw
>
>     get_current_fig_manager().canvas.draw()
>
>   File
> "/Library/Python/2.7/site-packages/matplotlib/backends/backend_tkagg.py",
> line 349, in draw
>
>     tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
>
>   File "/Library/Python/2.7/site-packages/matplotlib/backends/tkagg.py",
> line 20, in blit
>
>     tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
> id(bbox_array))
>
> _tkinter.TclError
>
> Matplot basically launches for about half a second and then crashes. The
> line in nupic_ouput.py that triggers the error is "import matplotlib.pyplot
> as plt". I'm reluctant to solve this problem by removing the System version
> of Tkinter. Any advice on this?
>
> Thanks
>
>
> Mika
>
>
>
> _______________________________________________
> nupic mailing list
> [email protected]
> http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org
>

_______________________________________________
nupic mailing list
[email protected]
http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org

Reply via email to