ctjacobs/pyqso

Basemap troubles on Ubuntu 14.10

partofthething opened this issue · 5 comments

I didn't have all the prereq's installed when I first ran this program. It loaded ok but I couldn't create a new DB (see #20). Anyway once I installed basemap, I get the following exception on load:

$ pyqso
Traceback (most recent call last):
  File "/usr/local/bin/pyqso", line 40, in <module>
    from pyqso.toolbox import *
  File "/usr/local/lib/python2.7/dist-packages/pyqso/toolbox.py", line 25, in <module>
    from pyqso.grey_line import *
  File "/usr/local/lib/python2.7/dist-packages/pyqso/grey_line.py", line 28, in <module>
    from mpl_toolkits.basemap import Basemap
  File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py", line 31, in <module>
    from mpl_toolkits.axes_grid1 import make_axes_locatable
  File "/usr/lib/pymodules/python2.7/mpl_toolkits/axes_grid1/__init__.py", line 4, in <module>
    from axes_grid import Grid, ImageGrid, AxesGrid
  File "/usr/lib/pymodules/python2.7/mpl_toolkits/axes_grid1/axes_grid.py", line 3, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 93, in <module>
    _backend_selection()
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 87, in _backend_selection
    if gobject.MainLoop().is_running():
  File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 62, in __getattr__
    raise AttributeError(_static_binding_error)
AttributeError: When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject". See: https://bugzilla.gnome.org/show_bug.cgi?id=709183

Frankly, this looks like a Basemap bug if anything but I wasn't able to track it down.

I'll set up Ubuntu 14.10 on a virtual machine and investigate. What version of matplotlib do you have installed? For what it's worth, I'm running PyQSO on Ubuntu 14.04 (Trusty) with matplotlib version 1.3.1 and that seems to work fine.

Strange. I'm using the versions right out of the Package Manager for 64-bit 14.10:

  • python-matplotlib 1.3.1-2ubuntu1
  • python-mpltoolkits.basemap 1.0.7+dfsg-1

I can reproduce this error on Ubuntu 14.10. I think a work-around is just to specify a different backend for matplotlib. The following patch fixes the issue for me - please could you apply it and let me know if it works for you too?

diff --git a/pyqso/grey_line.py b/pyqso/grey_line.py
index 5aff836..b56cd25 100644
--- a/pyqso/grey_line.py
+++ b/pyqso/grey_line.py
@@ -24,6 +24,7 @@ from datetime import datetime
 try:
    import numpy
    import matplotlib
+   matplotlib.use('Agg')
    matplotlib.rcParams['font.size'] = 10.0
    from mpl_toolkits.basemap import Basemap
    from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas

That patch works for me. Thanks!

Great! Thanks for giving PyQSO a try - I hope you find it useful. If you have any feature requests or ideas for improvement, please do feel free to submit them via the issue tracker.