Skip to content

unable to build the notebooks #41

@Thomas-Ulrich

Description

@Thomas-Ulrich

Hi,

For some reason (we were trying to create a new seismology exercise derived for rupture_2D), I tried to build the notebooks. And it turns out that I cannot build them.

Here is what I did:

pip install virtualenv
python -m venv envSeismoLive
source envSeismoLive/bin/activate
pip install --upgrade pip
pip install numpy
pip install scipy matplotlib jupyter jupytext nbconvert obspy pandas seaborn
python conf/convert_to_ipynb.py notebooks built_notebooks

(Python 3.7.4)

and here is what I get:

(envSeismoLive) (base) ulrich@ulrich-ThinkPad-T490s:~/Downloads/seismo_live$ python conf/convert_to_ipynb.py notebooks built_notebooks
Convert to .ipynb file.
[jupytext] Reading built_notebooks/notebooks/Data Visualization/Intro_to_visualization.py
[jupytext] Writing built_notebooks/notebooks/Data Visualization/Intro_to_visualization.ipynb (destination file replaced)
Running .ipynb file: built_notebooks/notebooks/Data Visualization/Intro_to_visualization.ipynb
[NbConvertApp] Converting notebook built_notebooks/notebooks/Data Visualization/Intro_to_visualization.ipynb to notebook
[NbConvertApp] Executing notebook with kernel: python3
[NbConvertApp] Writing 795726 bytes to built_notebooks/notebooks/Data Visualization/Intro_to_visualization.ipynb
Converting to HTML: built_notebooks/notebooks/Data Visualization/Intro_to_visualization.ipynb
[NbConvertApp] Converting notebook built_notebooks/notebooks/Data Visualization/Intro_to_visualization.ipynb to html
[NbConvertApp] Writing 1109632 bytes to built_notebooks/html/Data Visualization/Intro_to_visualization.html
Convert to .ipynb file.
[jupytext] Reading built_notebooks/notebooks/Ambient Seismic Noise/NoiseCorrelation.py
[jupytext] Writing built_notebooks/notebooks/Ambient Seismic Noise/NoiseCorrelation.ipynb
Running .ipynb file: built_notebooks/notebooks/Ambient Seismic Noise/NoiseCorrelation.ipynb
[NbConvertApp] Converting notebook built_notebooks/notebooks/Ambient Seismic Noise/NoiseCorrelation.ipynb to notebook
[NbConvertApp] Executing notebook with kernel: python3
[NbConvertApp] ERROR | Error while converting 'built_notebooks/notebooks/Ambient Seismic Noise/NoiseCorrelation.ipynb'
Traceback (most recent call last):
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 197, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/exporters/notebook.py", line 32, in from_notebook_node
    nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 139, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 316, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
    return self.preprocess(nb, resources)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 405, in preprocess
    nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/preprocessors/base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "/home/ulrich/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 448, in preprocess_cell
    raise CellExecutionError.from_cell_and_msg(cell, out)
nbconvert.preprocessors.execute.CellExecutionError: An error occurred while executing the following cell:
------------------
# Preprocessing 2
st = stp.copy()                            # copy stream

for tr in st:
    tr = normalize(tr, norm_method="1bit")
    tr = whiten(tr, 0.1, 0.2)
print ('done!')
------------------

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
    116     try:
--> 117         num = operator.index(num)
    118     except TypeError:

TypeError: 'float' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-5-290f7feaa7bd> in <module>
      4 for tr in st:
      5     tr = normalize(tr, norm_method="1bit")
----> 6     tr = whiten(tr, 0.1, 0.2)
      7 print ('done!')

<ipython-input-4-39b7c3512fe4> in whiten(tr, freqmin, freqmax)
     82 
     83         # Apodization to the right with cos^2 (to smooth the discontinuities)
---> 84         smo2 = (np.cos(np.linspace(0., np.pi/2., nsmo+1.))**2.)
     85         espo = np.exp(1j * np.angle(FFTs[JJ[-1]-nsmo:JJ[-1]+1]))
     86         FFTsW[JJ[-1]-nsmo:JJ[-1]+1] = smo2 * espo

<__array_function__ internals> in linspace(*args, **kwargs)

~/Downloads/seismo_live/envSeismoLive/lib/python3.7/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
    119         raise TypeError(
    120             "object of type {} cannot be safely interpreted as an integer."
--> 121                 .format(type(num)))
    122 
    123     if num < 0:

TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.
TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.

Traceback (most recent call last):
  File "conf/convert_to_ipynb.py", line 249, in <module>
    html_folder=html_folder,
  File "conf/convert_to_ipynb.py", line 223, in convert_folder
    html_folder=html_folder,
  File "conf/convert_to_ipynb.py", line 186, in convert_file
    check=True,
  File "/home/ulrich/miniconda3/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['jupyter', 'nbconvert', '--to', 'notebook', '--ExecutePreprocessor.timeout=600', '--execute', '--inplace', 'built_notebooks/notebooks/Ambient Seismic Noise/NoiseCorrelation.ipynb']' returned non-zero exit status 1.

Any idea what could be the problem? Seems like a problem in obspy?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions