ipyleaflet icon indicating copy to clipboard operation
ipyleaflet copied to clipboard

"Timeout waiting for IOPub output" when converting to html with nbconvert

Open julienbrunaermc opened this issue 3 years ago • 0 comments

Hi everyone,

I'm trying to convert a notebook that displays several maps showing CircleMarkers (673 each) which are created from a pandas dataframe, grouped in different layer groups.

with the folowing command : jupyter nbconvert --TemplateExporter.exclude_input=True --ExecutePreprocessor.timeout=300 --ExecutePreprocessor.iopub_timeout=300 --to=html --execute DEV-Etat-chimique-eso.ipynb The problem is that while the conversion is running I get this warning : [NbConvertApp] WARNING | Timeout waiting for IOPub output It finishes without error but the first map is not complete : some points are note loaded. Surprisingly the other one are complete and doesnt raise a warning !

I tried differents things :

  • I increased --ExecutePreprocessor.iopub_timeout to 1200 (20 minutes), nothing changed
  • I decreased the number of points to show, and my maps displayed all well untill 500, but when I limit to 600 I get again the same problem, even increasing the timout to 1200.

So it seems I passed a limit but I dont know which because I only get this IOPub timout warning ...

Does someone has an idea of what is going on ?

Thanks in advance !

I pasted here the two functions I uses to create my maps :

 def circle_markers_from_df (data, x, y, radius, color_column, fill_opacity, weight, popup_html, popup_var, title, credit):
    layerg = LayerGroup(name=title, attribution=credit)
    data.sort_values(by="classe_etat", ascending=True, inplace=True, na_position='first')
    data.reset_index(drop=True, inplace=True)
    for index, row in data.iterrows():
        circle = CircleMarker()
        circle.location = (row[x], row[y])
        circle.color = row[color_column]
        circle.fill_color = row[color_column]
        circle.radius = radius
        circle.weight = weight
        pop = HTML()
        popup_dict = {}
        for var in popup_var:
            popup_dict[var] = row[var]
        pop.value = popup_html.format(popup_dict)
        circle.popup = pop
        layerg.add_layer(circle)
        del circle
    return layerg
            
def create_map (df_data, famille, diffusion):
    # FOND DE CARTE OSM
    mapnik = basemap_to_tiles(basemaps.OpenStreetMap.Mapnik)
    mapnik.base = True
    mapnik.name = 'Fond OpenStreetMap seul'
    mapnik.attribution = 'OpenStreetMap'
    
    # FOND MASSES D'EAU
    wms = WMSLayer(url=url_wms,
                    layers='vw_s_mdosout_affl',
                    format='image/png',
                    transparent=True,
                    opacity = 0.8,
                    attribution=credit)
    wms_group = LayerGroup(layers=(mapnik, wms), name="Masses d'eau et fond OpenStreetMap", base=True)
    
    # DEFINITION DE LA CARTE, DES LEGENDES ET DES CONTROLES
    m = L.Map(layers=[mapnik, wms_group], center=default_center, zoom=5.5, zoom_snap=0.25, scroll_wheel_zoom=True)
    fs = FullScreenControl()
    m.add_control(fs)
    lc = LayersControl(position='topright')
    m.add_control(lc)
    legend1 = LegendControl(legend=legend_etat_dict, name="Etat à la station", position="bottomleft")
    m.add_control(legend1)
    legend2 = LegendControl(legend=legend_typo_mdo_dict, name="Typologie des masses d'eau", position="bottomright")
    m.add_control(legend2)
    
    # CREATION DES COUCHES PAR REGION
    lst_reg = sorted(df.region.unique().tolist())
    for reg in lst_reg:
        lg = circle_markers_from_df(
            data=df[df['region'] == reg].reset_index(), 
            x="lat", y="lon", 
            radius = 4,
            color_column = 'couleur',
            fill_opacity = 0.8,
            weight = 2,
            popup_html = "<b>{0[codsta]}</b> - {0[nomsta]}</br>"
                        "<b>Réseau(x) d'appartenance :</b> {0[reseaux]}</br>"
                        "<b>Paramètre(s) en état médiocre :</b> {0[param_med]}</br>"
                        '<b>Fiche Etat :</b> <a href="https://rhone-mediterranee.eaufrance.fr/station-{0[codsta]}" target="_blank">lien</a>', 
            popup_var = ['codsta', 'nomsta', 'reseaux', 'param_med'],
            title = 'Stations DCE - ' + reg,
            credit = credit)
        
        m.add_layer(lg)
    return m

julienbrunaermc avatar Jul 13 '22 15:07 julienbrunaermc