Keck-DataReductionPipelines / MosfireDRP

http://keck-datareductionpipelines.github.io/MosfireDRP
10 stars 13 forks source link

macosx backend is broken on recent matplotlib #67

Closed lucarizzi closed 7 years ago

lucarizzi commented 7 years ago

The fix is to add:

import matplotlib matplotlib.use('TkAgg')

at the beginning of the driver files or on the first

import MOSFIRE

joshwalawender commented 7 years ago

Appears to be fixed in 2016 release branch by forcing use of TkAgg backend for matplotlib.

followthesheep commented 7 years ago

Do we really want to force people to use TkAgg? What if they don't have it installed or if they are running the pipeline in a Jupyter notebook?

On Tue, Dec 6, 2016 at 3:10 PM, Josh Walawender notifications@github.com wrote:

Appears to be fixed in 2016 release branch by forcing use of TkAgg backend for matplotlib.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/67#issuecomment-265303225, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHfPwtYz6TQ5JwaYybokPXR3I-ROMIdks5rFet0gaJpZM4K1vCx .

joshwalawender commented 7 years ago

@followthesheep Hopefully this is a short term workaround until the macos backend is fixed. The macOS backend is broken w.r.t. interactivity, so if we don't force something else, a large fraction of users will appear to have a broken DRP.

followthesheep commented 7 years ago

Can we ask the users to set their backend in their .matplotlibrc to TkAgg if their backend doesn't work? That way, it's not in the main code. I think it would make the code easier to maintain and debug.

On Tue, Dec 6, 2016 at 3:17 PM, Josh Walawender notifications@github.com wrote:

@followthesheep https://github.com/followthesheep Hopefully this is a short term workaround until the macos backend is fixed. The macOS backend is broken w.r.t. interactivity, so if we don't force something else, a large fraction of users will appear to have a broken DRP.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/67#issuecomment-265304477, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHfP93KzWUXXISiBjBU-0hEE2X5AHG7ks5rFez1gaJpZM4K1vCx .

joshwalawender commented 7 years ago

In my experience, the .matplotlibrc file is pretty opaque (even it's location is a mystery depending on system and version). TkAgg appears to work by default on linux (CentOS/Red Hat) and on macOS, so I think we impact fewer users this way. I'd rather have this situation where a small number of users are inconvenienced because they have a system without TkAgg, versus needing special instructions for a large fraction of users (macOS users), but I'm willing to be convinced otherwise

followthesheep commented 7 years ago

I'm not sure I like the idea of the MOSFIRE code just overriding a user's software environment though. If I were to import the MOSFIRE module, it will set my backend to TkAgg regardless of what my .matplotlibrc is doing. This will be tremendously frustrating since a user will not know what module changed this. Imagine how horrible it would be if every piece of software were to change your backend. I also don't think .matplotlibrc is mysterious. There are clear instructions on the matplotlib website about this. Our software release schedule is pretty slow and users update even more slowly so this fix could turn out to be in their code for a long time.

On Tue, Dec 6, 2016 at 3:26 PM, Josh Walawender notifications@github.com wrote:

In my experience, the .matplotlibrc file is pretty opaque (even it's location is a mystery depending on system and version). TkAgg appears to work by default on linux (CentOS/Red Hat) and on macOS, so I think we impact fewer users this way. I'd rather have this situation where a small number of users are inconvenienced because they have a system without TkAgg, versus needing special instructions for a large fraction of users (macOS users), but I'm willing to be convinced otherwise

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/67#issuecomment-265306402, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHfP-tWNB-iIxN63afkk-0yFNEzN8oyks5rFe8tgaJpZM4K1vCx .

joshwalawender commented 7 years ago

Ah, I see. I've been assuming most users run the pipeline using mospy [cmd], in which case the backend change is invisible to them (as long as it works). Is this not the case? This is the only way I have tested the software.

KeckDRP commented 7 years ago

Tuan

The problem is that the standard macosx backend is broken. If we don't decide on a backend, the interactive wavelength solution will not work at all.

You can keep your .matplotlibrc set in any way you like for every other Python code that you run but when you run mospy it will temporarily force TgAgg only when you run the pipeline Wouldn't it be even worse to ask the users to make a change to their .matplotlibrc ? If they do that, they would have to switch back and forth between their preferred backend and the one required by the mosfire pipeline

Also, i am not sure I understand your point about importing the mosfire module resulting in a change of the backend. The tkagg backend is set in the driver file, not in the mosfire module. If you import the mosfire module but you don't run the driver file, nothing changes.

On Dec 6, 2016, at 1:39 PM, Josh Walawender notifications@github.com wrote:

Ah, I see. I've been assuming most users run the pipeline using mospy [cmd], in which case the backend change is invisible to them (as long as it works). Is this not the case? This is the only way I have tested the software.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

followthesheep commented 7 years ago

Maybe the solution is to fix what is wrong with the interactive module and os x backend. Do you know why it is broken? Is there a matplotlib issue associated with this?

On Tue, Dec 6, 2016 at 9:50 PM, MosfireDRP notifications@github.com wrote:

Tuan

The problem is that the standard macosx backend is broken. If we don't decide on a backend, the interactive wavelength solution will not work at all.

You can keep your .matplotlibrc set in any way you like for every other Python code that you run but when you run mospy it will temporarily force TgAgg only when you run the pipeline Wouldn't it be even worse to ask the users to make a change to their .matplotlibrc ? If they do that, they would have to switch back and forth between their preferred backend and the one required by the mosfire pipeline

Also, i am not sure I understand your point about importing the mosfire module resulting in a change of the backend. The tkagg backend is set in the driver file, not in the mosfire module. If you import the mosfire module but you don't run the driver file, nothing changes.

On Dec 6, 2016, at 1:39 PM, Josh Walawender notifications@github.com wrote:

Ah, I see. I've been assuming most users run the pipeline using mospy [cmd], in which case the backend change is invisible to them (as long as it works). Is this not the case? This is the only way I have tested the software.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/67#issuecomment-265362092, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHfP643BlWopLKC3uV9BWxJDDMkbjleks5rFkkfgaJpZM4K1vCx .

KeckDRP commented 7 years ago

There is nothing wrong with the interactive module: the problem was introduced by the recent releases of matplotlib. It's quite easy to find users complaining about it by googling it. In fact using an older version of matplotlib fixes the problem. Even a simple plot will break if you make it interactive, with no reference to our modules or to the pipeline. It is the macosx backend that is broken.

On Dec 6, 2016, at 8:36 PM, Tuan Do notifications@github.com wrote:

Maybe the solution is to fix what is wrong with the interactive module and os x backend. Do you know why it is broken? Is there a matplotlib issue associated with this?

On Tue, Dec 6, 2016 at 9:50 PM, MosfireDRP notifications@github.com wrote:

Tuan

The problem is that the standard macosx backend is broken. If we don't decide on a backend, the interactive wavelength solution will not work at all.

You can keep your .matplotlibrc set in any way you like for every other Python code that you run but when you run mospy it will temporarily force TgAgg only when you run the pipeline Wouldn't it be even worse to ask the users to make a change to their .matplotlibrc ? If they do that, they would have to switch back and forth between their preferred backend and the one required by the mosfire pipeline

Also, i am not sure I understand your point about importing the mosfire module resulting in a change of the backend. The tkagg backend is set in the driver file, not in the mosfire module. If you import the mosfire module but you don't run the driver file, nothing changes.

On Dec 6, 2016, at 1:39 PM, Josh Walawender notifications@github.com wrote:

Ah, I see. I've been assuming most users run the pipeline using mospy [cmd], in which case the backend change is invisible to them (as long as it works). Is this not the case? This is the only way I have tested the software.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/67#issuecomment-265362092, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHfP643BlWopLKC3uV9BWxJDDMkbjleks5rFkkfgaJpZM4K1vCx .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

followthesheep commented 7 years ago

Sorry, that's what I meant, is there a matplotlib issue in their github page associated with this? Can you point me to it? If not we should make one if it affects us.

On Tue, Dec 6, 2016 at 10:50 PM, MosfireDRP notifications@github.com wrote:

There is nothing wrong with the interactive module: the problem was introduced by the recent releases of matplotlib. It's quite easy to find users complaining about it by googling it. In fact using an older version of matplotlib fixes the problem. Even a simple plot will break if you make it interactive, with no reference to our modules or to the pipeline. It is the macosx backend that is broken.

On Dec 6, 2016, at 8:36 PM, Tuan Do notifications@github.com wrote:

Maybe the solution is to fix what is wrong with the interactive module and os x backend. Do you know why it is broken? Is there a matplotlib issue associated with this?

On Tue, Dec 6, 2016 at 9:50 PM, MosfireDRP notifications@github.com wrote:

Tuan

The problem is that the standard macosx backend is broken. If we don't decide on a backend, the interactive wavelength solution will not work at all.

You can keep your .matplotlibrc set in any way you like for every other Python code that you run but when you run mospy it will temporarily force TgAgg only when you run the pipeline Wouldn't it be even worse to ask the users to make a change to their .matplotlibrc ? If they do that, they would have to switch back and forth between their preferred backend and the one required by the mosfire pipeline

Also, i am not sure I understand your point about importing the mosfire module resulting in a change of the backend. The tkagg backend is set in the driver file, not in the mosfire module. If you import the mosfire module but you don't run the driver file, nothing changes.

On Dec 6, 2016, at 1:39 PM, Josh Walawender < notifications@github.com> wrote:

Ah, I see. I've been assuming most users run the pipeline using mospy [cmd], in which case the backend change is invisible to them (as long as it works). Is this not the case? This is the only way I have tested the software.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/67# issuecomment-265362092, or mute the thread https://github.com/notifications/unsubscribe-auth/ ADHfP643BlWopLKC3uV9BWxJDDMkbjleks5rFkkfgaJpZM4K1vCx .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/67#issuecomment-265370119, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHfP4n3kvypwzmYx9UoMT_iLYwVJRV-ks5rFldRgaJpZM4K1vCx .

lucarizzi commented 7 years ago

https://github.com/matplotlib/matplotlib/issues/665

https://github.com/ContinuumIO/anaconda-issues/issues/784

https://github.com/matplotlib/matplotlib/pull/6178