Closed gildepaz closed 4 years ago
Searching for a solution I found that adding the following two lines in megaradrp-overplot_traces works (and it does): import matplotlib matplotlib.use('TkAgg') I have tried to add those two lines also in numina-check_wlcalib and numina-wavecalib. Let's see how it goes (still running).
BTW, this seems to be a MacOSX only problema.
It did not work in the case of the wavelength calibration. I am worried that it won't work for any task with graphical display. Please, check it out! THANKS!
In the case of the wavelength calibration the error starts with: 2019-02-14 21:26:58.943 python[33818:1476403] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7ff4623a8dd0 2019-02-14 21:26:58.945 python[33818:1476403] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7ff4623a8dd0' First throw call stack: ( 0 CoreFoundation 0x00007fff31b10ecd exceptionPreprocess + 256 1 libobjc.A.dylib 0x00007fff5dbc8720 objc_exception_throw + 48 2 CoreFoundation 0x00007fff31b8e275 -[NSObject(NSObject) retain_OA] + 0 3 CoreFoundation 0x00007fff31ab2b40 forwarding + 1486 4 CoreFoundation 0x00007fff31ab24e8 _CF_forwarding_prep_0 + 120 5 libtk8.6.dylib 0x0000000b24b9b134 TkpInit + 324 6 libtk8.6.dylib 0x0000000b24af30ce Initialize + 2622 7 _tkinter.cpython-37m-darwin.so 0x0000000b2491ca0f _tkinter_create + 1183 8 python 0x000000010f0048b6 _PyMethodDef_RawFastCallKeywords + 230 9 python 0x000000010f141ba2 call_function + 306
It works for me! just with numina and megaradrp updated!
I did not do that because the developers told me to start with a new conda installation without using the development one, sad!
It finally worked editing also numina and numina-ximplotxy and numina-ximshow in anaconda3/bin/ and anaconda3/envs/megara/bin but I could not fix updating with git pull & python setup.py build + install because that part did not work in my installation (see issue #231 )
This is a problem with the documentation of the installation of numina (it happens via conda or pip, the error message is just different).
The correct solution of this problem is to install in your environment the default matplotlib backend.
To find out which backend your installation is considering the default, run the following command
python -c "import matplotlib;print(matplotlib.get_backend())"
Then, you have to be sure that package that provides this backend is installed
It works is you precede the commands with MPLBACKEND=TkAgg or use a $HOME/.matplotlib/matplotlibrc with only "backend: TkAgg" (or any other backend of your like - that is installed, of course)
So, after a bit of testing with @gildepaz and @acasmor, the behavior seems to be:
If you are in a Mac with conda and the package suporting you backend is installed:
The failure happens only if your backend comes from the matplotlib defaults, even when the backend is the same (TkAgg)
So this will fail python -c "import matplotlib.pyplot as plt;plt.plot([1,2], [1,2]);plt.show()"
and this won't MPLBACKEND=TkAgg python -c "import matplotlib.pyplot as plt;plt.plot([1,2], [1,2]);plt.show()"
This seems a matplotlib3/conda bug
Seems related to this https://github.com/ContinuumIO/anaconda-issues/issues/10219
I run numina and I get the following error. I first thought it was a problem specific of numina but I got the same error running megaradrp-overplot_traces:
(megara) bash-3.2$ megaradrp-overplot_traces --rawimage data/0001900806-20181231-MEGARA-MegaraArcCalibration.fits obsid4-Tracemap_LCB_MR-G__results/master_traces.json --global_offset 0.0