BU-hammerTeam / PyHammer

A Python Spectral Typing Suite
MIT License
53 stars 14 forks source link

matplotlib import fails in eyecheck.py #11

Closed ctheissen closed 7 years ago

ctheissen commented 7 years ago

I get the following issue (on a fairly new mac) when running the test case:

Traceback (most recent call last): File "pyhammer.py", line 12, in <module> from eyecheck import Eyecheck File "/Users/Chris/repos/PyHammer/eyecheck.py", line 8, in <module> import matplotlib.pyplot as plt File "/usr/local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module> _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup globals(),locals(),[backend_name],0) File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/backend_qt4agg.py", line 18, in <module> from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module> from .backend_qt5 import QtCore File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 26, in <module> import matplotlib.backends.qt_editor.figureoptions as figureoptions File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in <module> import matplotlib.backends.qt_editor.formlayout as formlayout File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in <module> from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module> from PyQt4 import QtCore, QtGui ModuleNotFoundError: No module named 'PyQt4'

The issue seems to be that newer macs use PyQt5 instead of PyQt4. The fix was to change matplotlib.use('Qt4Agg') to matplotlib.use('Qt5Agg')

Just thought you might want to add a check for which PyQt is installed.

westukiah commented 7 years ago

Yes, especially since the pyhammer paper is on astro-ph today.

Congrats to Aurora and the team for getting this accomplished and our!

On Feb 23, 2017, at 11:29 PM, Chris Theissen notifications@github.com wrote:

I get the following issue (on a fairly new mac) when running the test case:

Traceback (most recent call last): File "pyhammer.py", line 12, in from eyecheck import Eyecheck File "/Users/Chris/repos/PyHammer/eyecheck.py", line 8, in import matplotlib.pyplot as plt File "/usr/local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/init.py", line 32, in pylab_setup globals(),locals(),[backend_name],0) File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/backend_qt4agg.py", line 18, in from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in from .backend_qt5 import QtCore File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 26, in import matplotlib.backends.qt_editor.figureoptions as figureoptions File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in import matplotlib.backends.qt_editor.formlayout as formlayout File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore File "/usr/local/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 137, in from PyQt4 import QtCore, QtGuiModuleNotFoundError: No module named 'PyQt4'

The issue seems to be that newer macs use PyQt5 instead of PyQt4. The fix was to change matplotlib.use('Qt4Agg') to matplotlib.use('Qt5Agg')

Just thought you might want to add a check for which PyQt is installed.

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

zephyr5050 commented 7 years ago

Thanks for letting us know. It seems Python 3.6 dropped support for PyQt4. Code now searches for both PyQt4 and PyQt5.