You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
matplotlib 1.5.3 raise TypeError: 'module' object is not subscriptable on pylab.py #7186
BTW:maybe have something wrong because I found python 2.7.5 also raise TypeError: 'module' object has no attribute '__getitem__' in this line but have no one report
Yes, are you sure it's happening with %matplotlib inline? Also, how old is your ipython? From the code, it appears that only the %pylab magic should import all the extra stuff, and this should have been true since at least the 3.x line.
Actually, scratch that. There's a lot of indirection to trawl through, but it appears there is a matplotlib.pylab import here. It does not insert this into the namespace though, which is a key difference between the %matplotlib and %pylab magics. I'm not sure it's really necessary; that sort of thing probably should be reported downstream so they can stop using it.
Activity
tacaswell commentedon Sep 27, 2016
I would also suggest not using
pylab. I suspect we will find a lot of these edge cases as people start to use mpl with pypy.zjjott commentedon Sep 28, 2016
actually,I just have a try like this:
Looks like have many difference between CPython and PyPy such as execution model/ type system, I'll give a try to figure out the truth
tacaswell commentedon Sep 28, 2016
Ah, the problem is that IPython imports pylab
WeatherGod commentedon Sep 28, 2016
does it do so unconditionally?
On Wed, Sep 28, 2016 at 9:42 AM, Thomas A Caswell notifications@github.com
wrote:
zjjott commentedon Sep 28, 2016
IPython imports pylab when use
%matplotlib inlinemagic modeI change mpl to svg mode and it works
NelleV commentedon Oct 11, 2016
eh… ipython still imports pylab? I thought that was deprecated a long time ago?
QuLogic commentedon Oct 12, 2016
Yes, are you sure it's happening with
%matplotlib inline? Also, how old is your ipython? From the code, it appears that only the%pylabmagic should import all the extra stuff, and this should have been true since at least the 3.x line.QuLogic commentedon Oct 12, 2016
Actually, scratch that. There's a lot of indirection to trawl through, but it appears there is a
matplotlib.pylabimport here. It does not insert this into the namespace though, which is a key difference between the%matplotliband%pylabmagics. I'm not sure it's really necessary; that sort of thing probably should be reported downstream so they can stop using it.tacaswell commentedon Oct 12, 2016
ipython/ipython#9998 <- IPython PR to fix at least some of this.
tacaswell commentedon Oct 12, 2016
and for 1.5.3 + the
%matplotlib magic isn't needed anymore, importingpyplotand callingplt.ion()` is now sufficient to properly hook up the event loopsDon't use __builtins__ (an impl. detail) in pylab.