简体   繁体   中英

Dataspell outputs the following error: Local cdn resources have problems on chrome/safari when used in jupyter-notebook

faced with such an error: Local cdn resources have problems on chrome/safari when used in jupyter-notebook. It appears when working with the pyvis library.

net = Network(notebook=True)

net.add_nodes(
    [1, 2, 3, 4, 5],  # node ids
    label=['Node #1', 'Node #2', 'Node #3', 'Node #4', 'Node #5'],  # node labels
    # node titles (display on mouse hover)
    title=['Main node', 'Just node', 'Just node', 'Just node', 'Node with self-loop'],
    color=['#d47415', '#22b512', '#42adf5', '#4a21b0', '#e627a9']  # node colors (HEX)
)
net.add_edges([(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (5, 1)])

net.show('graph.html')

enter image description here

I tried switching the browser to dataspell

From pyvis documentation :

while using notebook in chrome browser, to render the graph, pass additional kwarg 'cdn_resources' as 'remote' or 'inline'

I did net = Network(notebook=True, cdn_resources='in_line')

A note from me - you have to use 'in_line' instead of 'inline'. From sources :

assert cdn_resources in ["local", "in_line", "remote"], "cdn_resources not in [local, in_line, remote]."

Additionally, pyvis output render is an open feature request for DataSpell at the moment. Watch and upvote this ticket if you're interested: DS-3446

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM