Numpy.float error using stream.plot

I am getting a runtime error on one of my scripts, originating from stream.plot and caused by changes in numpy. How can I get round this?

Traceback (most recent call last):
  File "./", line 102, in <module>
  File "./", line 97, in main
    st.plot( equal_scale=False, size=(1600,800), outfile=file_plot, linewidth=0.2, starttime=plotBeg, endtime=plotEnd )
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/core/", line 1161, in plot
    return waveform.plot_waveform(*args, **kwargs)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/imaging/", line 278, in plot_waveform
    self.plot(*args, **kwargs)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/imaging/", line 403, in plot
    self.__plot_min_max(stream_new[_i], ax, *args, **kwargs)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/obspy/imaging/", line 768, in __plot_min_max
    extreme_values = np.empty((pixel_count + 1, 2), dtype=np.float)
  File "/home/seisan/anaconda3/envs/obspy/lib/python3.8/site-packages/numpy/", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:

probably the easiest way would be to upgrade obspy?


I didn’t think it was out of date, but I’ll check.

That worked. Many thanks. I’m a twit.

1 Like

Errors like this, search in our issue tracker and usually you find information about if, when and how it was fixed and if not you can open a ticket to let us know.

1 Like