Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugging matplotlib #3263

Closed
neuronphysics opened this issue Jul 15, 2014 · 7 comments
Closed

debugging matplotlib #3263

neuronphysics opened this issue Jul 15, 2014 · 7 comments
Labels
status: needs clarification Issues that need more information to resolve.

Comments

@neuronphysics
Copy link

The matplotlib was so far working in my pc very well but then I started getting problem to import pyplab and pyplot. Therefore I installed again matplotlib and when I ran the troubleshoot command I got the following error message:

python examples/pylab_examples/simple_plot.py
Traceback (most recent call last):
  File "examples/pylab_examples/simple_plot.py", line 11, in <module>
    savefig("test.png")
  File "/vol/aibn84/aibn84_2/anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 573, in savefig
    draw()   # need this if 'transparent=True' to reset colors
  File "/vol/aibn84/aibn84_2//anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 566, in draw
    get_current_fig_manager().canvas.draw()
  File "/vol/aibn84/aibn84_2/anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/backends/backend_tkagg.py", line 351, in draw
    tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
  File "/vol/aibn84/aibn84_2/anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/backends/tkagg.py", line 24, in blit
    tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
_tkinter.TclError

I don't understand what caused the problem?

@kebarr
Copy link

kebarr commented Jul 29, 2014

I have also seen this issue. and reproduce it using:

from matplotlib import pyplot
x = range(1,10)
y = [n**2 for n in x]
pyplot.plot(x,y)
pyplot.show() 

sometimes it raises this error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in __call__
    return self.func(*args)
  File "/home/katiebarr/.virtualenvs/name/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_tkagg.py", line 276, in resize
    self.show()
  File "/home/katiebarr/.virtualenvs/name/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_tkagg.py", line 349, in draw
    tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
  File "/home/katiebarr/.virtualenvs/name/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/backends/tkagg.py", line 20, in blit
    tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
TclError

sometimes it raises a segfault·

I am using matplotlib 1.3.1, though that is the version I am using. I am using ubuntu 14.04, having updated yesterday. I did not see this issue before the update.
I am using tcl/tk 8.6.

for completeness as I edited this while tacaswell responded. I found a simple script to reproduce the error here: https://bugs.launchpad.net/ubuntu/+source/matplotlib/+bug/1266605 . a colleague of mine with the same OS/Tk/matplotlib versions as me doesn't see the error so not sure its the same bug.

@tacaswell tacaswell added this to the unassigned milestone Jul 29, 2014
@tacaswell
Copy link
Member

Try re-installing tcl via anaconda (as it looks like you are using conda from your paths). How did you install everything you are using?

@kebarr It looks like the problem on that bug report is in the debian build scripts, not something on our side.

@kebarr
Copy link

kebarr commented Jul 29, 2014

tacaswell- do you have any advice for further debugging? We have tried digging into the matplotlib code to try and find out exactly where it fails, we're not sure if this is a matplotlib or Tkinter issue, or indeed something else entirely.

@tacaswell
Copy link
Member

ah, you linked to a ubuntu/dedian bug so I assumed you were using a linux distribution.

In my opinion this is an OSX issue. I suspect that the problem is that you have ended up with crossed versions of python, tk, and matplotlib (which is very easy do to on OSX). The reason you are seeing this problem, but your college is not, is that it is a path issue and can depend on the order you installed stuff/exactly how you installed it.

My recommendation is to delete everything and then re-install from a single source (canopy, conda, homebrew ect). Which method you pick doesn't matter too much, the important thing is to not mix install methods.

#2025 may be related

@tacaswell
Copy link
Member

@neuronphysics Are you also on a mac?

@kebarr
Copy link

kebarr commented Jul 29, 2014

hey, thanks (i was actually on Ubuntu, the error occurred following an update to 14.04, I probably should have raised a new issue...), but I fixed it doing roughly what you said.

to make it work I had to remove tk and tk-dev and reinstall them, then create a new virtualenv and install matplotlib there. the order of the tk and matplotlib installs matters.

@pelson
Copy link
Member

pelson commented Nov 29, 2014

Looks like the version of Tcl moved on your system.

@pelson pelson closed this as completed Nov 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification Issues that need more information to resolve.
Projects
None yet
Development

No branches or pull requests

4 participants