cedadev / ceda-jaspy-envs

Conda (Jaspy) environments for CEDA/JASMIN
BSD 2-Clause "Simplified" License
5 stars 0 forks source link

avoid buggy ipython versions #141

Closed alaniwi closed 1 month ago

alaniwi commented 5 months ago

When invoked as ipython --pylab, there seems to be a bug in displaying matplotlib plots with certain versions of ipython, as installed from conda-forge.

Running the above command and then issuing the following command interactively inside ipython to produce a test plot:

plt.plot(np.arange(10) ** 2)

seems to work fine up to ipython 8.21.0 but fails for ipython 8.22.x -- the currently available versions in conda-forge go up to 8.22.2. (NB there is no need for imports in the test code - the --pylab flag means that matplotlib and numpy are preloaded.)

In the case of the later ipython versions, it is possible to force the display of the plot by using:

plt.show(block=True)

but this might not be convenient. It does not work with block=False.

Also, the problem doesn't seem to be specific to conda packages of ipython. Testing with ipython installed via pip instead of conda (but with matplotlib installed via conda), I find similar -- i.e. it works with 8.21.0, but fails with 8.22.x and also with 8.23.0, which is currently the latest in PyPI.

For the above, it makes no difference whether matplotlib 3.8.3 is used (latest available in conda-forge) or matplotlib 3.5.3 (version in jaspy/3.10/r20230718).

We need to pin ipython to 8.21.0 in Jaspy until a version becomes available that doesn't have this bug.

Also, maybe we need to write some kind of test, but this is complicated by the fact that it needs to be tested interactively.

alaniwi commented 5 months ago

Have now reported this at issue 14401 on the ipython repo.

(I'm not posting the full URL here, so as not to create a backlink, in case anyone objects to my term "buggy versions" -- although in context this refers to this specific bug only, and is not meant to imply that those versions contain multiple bugs.)

alaniwi commented 1 month ago

This is now fixed (and Jaspy release in preparation uses ipython 8.26.0). Closing.