Repository navigation
Closed
Labels
DEBissues related to Debian/Ubuntu packaging / packagesissues related to Debian/Ubuntu packaging / packagesexternalIt's not our fault!It's not our fault!release blockercritical issues blocking the corresponding future releasecritical issues blocking the corresponding future release
Milestone
Description
I tried to install the latest ObSpy version (first time on this computer) via the description provided for Linux/Ubuntu. I'm on a Ubuntu 16.04 LTS OS and running python3. The installation worked fine but using the read function gives the below error.
Installation instructions followed:
https://github.com/obspy/obspy/wiki/Installation-on-Linux-via-Apt-Repository
I have looked elsewhere and it seems to be an issue between having multiple python versions on my computer. Not sure how to resolve this
from obspy import read
FILE_PATH_ = "/home/example.mseed"
st = read(FILE_PATH_)
gives
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-ba5ca716a935> in <module>()
2 # https://github.com/obspy/obspy/wiki/Installation-on-Linux-via-Apt-Repository
3
----> 4 from obspy import read
5 FILE_PATH_ = "/home/codepan1/Downloads/Package_1506336094435.mseed"
6 st = read(FILE_PATH_)
/usr/lib/python3/dist-packages/obspy/__init__.py in <module>()
46 from obspy.core.trace import Trace # NOQA
47 from obspy.core.stream import Stream, read
---> 48 from obspy.core.event import read_events, Catalog
49 from obspy.core.inventory import read_inventory, Inventory # NOQA
50
/usr/lib/python3/dist-packages/obspy/core/event/__init__.py in <module>()
27 Comment, CompositeTime, ConfidenceEllipsoid, CreationInfo, DataUsed,
28 QuantityError, ResourceIdentifier, TimeWindow, WaveformStreamID)
---> 29 from .catalog import Catalog, read_events
30 from .event import Event, EventDescription
31 from .magnitude import (
/usr/lib/python3/dist-packages/obspy/core/event/catalog.py in <module>()
41 from .base import CreationInfo, ResourceIdentifier
42
---> 43 from .event import Event
44
45 EVENT_ENTRY_POINTS = ENTRY_POINTS['event']
/usr/lib/python3/dist-packages/obspy/core/event/event.py in <module>()
24 from obspy.core.event.header import (
25 EventType, EventTypeCertainty, EventDescriptionType)
---> 26 from obspy.imaging.source import plot_radiation_pattern, _setup_figure_and_axes
27
28 from .base import (_event_type_class_factory,
/usr/lib/python3/dist-packages/obspy/imaging/source.py in <module>()
19
20 import numpy as np
---> 21 from mpl_toolkits.mplot3d import Axes3D # NOQA
22 from matplotlib.cm import get_cmap
23
/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py in <module>()
2 unicode_literals)
3
----> 4 from matplotlib.externals import six
5
6 from .axes3d import Axes3D
ImportError: No module named 'matplotlib.externals'
Metadata
Metadata
Assignees
Labels
DEBissues related to Debian/Ubuntu packaging / packagesissues related to Debian/Ubuntu packaging / packagesexternalIt's not our fault!It's not our fault!release blockercritical issues blocking the corresponding future releasecritical issues blocking the corresponding future release
Activity
megies commentedon Sep 25, 2017
Looks like this could be a packaging problem (in any case, not in obspy, but in Debian/Ubuntu's matplotlib).
Can you try if the following code example works (i doubt it):
https://matplotlib.org/examples/mplot3d/contour3d_demo3.html
megies commentedon Sep 25, 2017
Looks like you're being affected by matplotlib/matplotlib#6556, in any case we need to sort this out for Ubuntu xenial..
wmbm commentedon Sep 26, 2017
As expected, the 3dcontour example has the same issue with importing externals. Are there any known fixes for this issue?
megies commentedon Sep 26, 2017
In principle this can only be fixed by an updated package from Ubuntu packaging teams.. but I'm not sure about their policy regarding non-security-related bugfixes.
What we can probably do is to avoid exposing that import on any obspy import..
i.e. move that import inside the routines where it's actually used. That won't fix the problem in general, but at least it will then only affect those respective routines..
megies commentedon Sep 26, 2017
As a quick-and-dirty fix, you could modify this file (as root): /usr/lib/python3/dist-packages/obspy/imaging/source.py
partial workaround for #1906, should still be fixed upstream in Ubuntu
megies commentedon Sep 26, 2017
See f4ebf5a
krischer commentedon Sep 26, 2017
Moving the
Axes3Dobject to the functions that actually require it might be a good idea in any case. It should also reduce initial import times.tacaswell commentedon Sep 26, 2017
This looks more like the OP has crossed installations of different versions (one from
sudo pipand one from the package manager). The mpl_toolkit is from the pip installation (and expect the base matplotlib to have the external modules) where as I strongly suspect that debian is de-bundling six and patching out the external module all together.megies commentedon Sep 27, 2017
@tacaswell how do you come to that conclusion? To my knowledge,
sudo pipwould end up under/usr/lib/python../site-packageswhereas packaged stuff goes to../dist-packages/. (I didn't really check in some while, have to admit).@wmbm can you comment on this? Did you run commands like
sudo pip install ...?wmbm commentedon Sep 27, 2017
The quick and dirty fix recommended by @megies worked.
I have previously done
sudo pip install ...commands, but can't exactly remember in this case.megies commentedon Sep 27, 2017
Messing with manual installations in the Python env handled by the systems' package manager is the highway to the danger zone. And you're bound to end up in non-replicable problems that you're on your own with..
I'm closing this, until someone else on a clean Ubuntu Xenial can confirm this one.
tacaswell commentedon Sep 28, 2017
@megies It was based on the thought that we had changed the imports so the offending file was from the wrong version, however it looks like me missed one. This was fixed in matplotlib/matplotlib#9237
QuLogic commentedon Sep 28, 2017
That PR didn't change
mplot3dthough; I'm not sure that was ever broken as I've tested ObsPy against 2.0 before. Still not sure what's up here.megies commentedon Sep 29, 2017
I just tried this in a docker xenial container, and I got no error, so I'd blame it on a broken environment unless somebody can confirm on a clean xenial system Python.
partial workaround for obspy#1906, should still be fixed upstream in …