Select to view content in your preferred language

AGOL : python lib install in jupyternotebook with pip

331
7
Jump to solution
07-16-2024 01:25 AM
Labels (1)
DISIG
by
New Contributor III

Hello everybody,

I am tring to install this python lib.

i am using jupyternotebook on arcgis online

when i run this code 

%pip install yfiles_jupyter_graphs --quiet
from yfiles_jupyter_graphs import GraphWidget

i have got this message 

DEPRECATION: Loading egg at /opt/conda/lib/python3.11/site-packages/tflite_model_maker-0.3.4-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
Note: you may need to restart the kernel to use updated packages.

how can i Avoid this?

0 Kudos
1 Solution

Accepted Solutions
fskpf
by
New Contributor

Maintainer of yfiles-jupyter-graphs here.

Just yesterday, we fixed an issue with our CDN deployment which made VSCode fail to load the widget (https://github.com/yWorks/yfiles-jupyter-graphs/issues/54).

I'm not familiar with how AGOL works, but maybe it uses the same approach as VSCode (which is different to how Google Colab loads the widget) and the same fix as described in the issue may work here too: Making sure to install the newest version of the widget (1.7.3). Please note that VSCode has some caching mechanism that made loading the newest version a bit tricky, so maybe this must be considered here as well.

View solution in original post

7 Replies
DanPatterson
MVP Esteemed Contributor

both document links you provided give the answer.  Don't use *,egg files.  It is just a warning, so it should have installed.

You can install yFiles Graphs for Jupyter using pip. Run the following command in your Jupyter Notebook or command line:

pip install yfiles_jupyter_graphs

and if that doesn't work, then see the alternates at

Installation - pip documentation v24.1.2 (pypa.io)

 

 


... sort of retired...
0 Kudos
DISIG
by
New Contributor III

Thank you for your answer Dan,

for me the code below works in google colab but it does not on agol.

 

from yfiles_jupyter_graphs import GraphWidget
w = GraphWidget()
w.nodes = [
{"id": 0, "properties": {"firstName": "Alpha", "label": "Person A"}},
{"id": "one", "properties": {"firstName": "Bravo", "label": "Person B"}},
{"id": 2.0, "properties": {"firstName": "Charlie", "label": "Person C", "has_hat": False}},
{"id": True, "properties": {"firstName": "Delta", "label": "Person D", "likes_pizza": True}}
]
w.edges = [
{"id": "zero", "start": 0, "end": "one", "properties": {"since": "1992", "label": "knows"}},
{"id": 1, "start": "one", "end": True, "properties": {"label": "knows", "since": "1992"}},
{"id": 2.0, "start": 2.0, "end": True, "properties": {"label": "knows", "since": "1992"}},
{"id": False, "start": 0, "end": 2.0, "properties": {"label": "knows", "since": 234}}
]
w.directed = True
display(w)

 

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'GraphModel' from module 'yfiles-jupyter-graphs'
Error: Script error for "yfiles-jupyter-graphs"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (https://notebooksservices1.arcgis.com/27be4f33be3945fc98c22c5ced05f817/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:168:17)
    at HTMLScriptElement.onScriptError (https://notebooksservices1.arcgis.com/27be4f33be3945fc98c22c5ced05f817/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735:36)

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

are the packages the same in both environments?


... sort of retired...
0 Kudos
fskpf
by
New Contributor

Maintainer of yfiles-jupyter-graphs here.

Just yesterday, we fixed an issue with our CDN deployment which made VSCode fail to load the widget (https://github.com/yWorks/yfiles-jupyter-graphs/issues/54).

I'm not familiar with how AGOL works, but maybe it uses the same approach as VSCode (which is different to how Google Colab loads the widget) and the same fix as described in the issue may work here too: Making sure to install the newest version of the widget (1.7.3). Please note that VSCode has some caching mechanism that made loading the newest version a bit tricky, so maybe this must be considered here as well.

DISIG
by
New Contributor III

No more error message. thank you.

 

0 Kudos
DISIG
by
New Contributor III

Hello every body,

!pip install yfiles-jupyter-graphs --upgrade
from yfiles_jupyter_graphs import GraphWidget

I will give some news when the graph functionnality will be integrated to my script that tracks items's relations inside an agol Site 🙂 .

 

 

0 Kudos
fskpf
by
New Contributor

Nice to hear that it worked on your end as well!

I would love to see your integration. I've yet to see an integration in this field.

0 Kudos