Giter Club home page Giter Club logo

Comments (7)

luizbergertrustly avatar luizbergertrustly commented on May 27, 2024 1

Back here with good news.

For some reason, trying to do this configuration directly from the notebook in one of the available kernels is not the way.

A teammate here tried some other configuration, and at the end, we managed to have it working.

By having these commands here on notebook start (via lifecycle policy, it's one of the sagemaker resources):

/home/ec2-user/anaconda3/envs/JupyterSystemEnv/bin/python3 -m pip install yfiles_jupyter_graphs
/home/ec2-user/anaconda3/envs/python3/bin/python3 -m pip install yfiles_jupyter_graphs

The lib is installed both in the system default environment, and on the kernel that we are going to use on the notebook.

I assume that trying to do this directly from the notebook, was not properly installing the library on the desired environment. Because it seems that the jupyter application runs on top of the jupyter configuration of the system env. Don't know if it makes sense, but resolution is pretty simple (after spending some days and with help from others :D).

Anyways, thanks for your help @yGuy and @fskpf!

from yfiles-jupyter-graphs.

yGuy avatar yGuy commented on May 27, 2024

This may sound like poor advice, but did you actually try to simply reload the page in the browser?
When a new widget gets installed on the kernel that uses JavaScript, the default jupyter notebook implementation does not manage to update the state of the widget registry in the browser. So restarting the kernel may not only be not enough, but actually the wrong tip. It only updates the data structures in the kernel but still doesn't update the widget registry.

So could you simply reload the browser and see if that helps?

I only ever saw this problem when installing the widget in the kernel and using it directly in the same browser session. This doesn't happen with Google Colab, e.g., because it dynamically fetches the widget from a CDN rather than loading it from the local kernel via the local registry.

I think we should copy that "important" bit from here: https://stackoverflow.com/a/60059786/351836

This is what phind.com had to say about this:

Yes, it is correct that after installing Jupyter widgets, you may need to reload the browser to make them work and appear in the widget registry. This is because the widgets rely on JavaScript libraries that are loaded by the browser. When you install or update these libraries, the browser needs to refresh its cache to recognize the new or updated widgets. This process ensures that the widgets are properly integrated into the Jupyter environment and can be interacted with as intended.

from yfiles-jupyter-graphs.

luizbergertrustly avatar luizbergertrustly commented on May 27, 2024

Hey, @yGuy .

Thanks for reaching out. I have tried a different browser (Safari), also refreshing and force refreshing the page, but no success.

Also, under the Manager Extension tab, i have installed the plugin from there, no success, too. :(

image

from yfiles-jupyter-graphs.

yGuy avatar yGuy commented on May 27, 2024

:-( - I don't know enough about how Sagemaker could be different from a regular jupyter notebook server.

Just yesterday I used this super simple docker image on my local machine:

FROM jupyter/scipy-notebook
RUN pip install yfiles-jupyter-graphs

With (what I think) is the most recent versions of the base image and our plugin and it still worked flawlessly for me.

This results in this configuration:

Python 3.11.6

JupyterLab v4.0.7
/opt/conda/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
        yfiles-jupyter-graphs v1.6.2 enabled OK (python, yfiles_jupyter_graphs)
        nbdime-jupyterlab v2.2.0 enabled  X
        jupyter-matplotlib v0.11.3 enabled OK
        @jupyter-notebook/lab-extension v7.0.6 enabled OK
        @jupyter-widgets/jupyterlab-manager v5.0.9 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/git v0.41.0 enabled  X (python, jupyterlab-git)


   The following extensions are outdated:
        jupyterlab_pygments
        nbdime-jupyterlab
        @jupyterlab/git
        
   Consider checking if an update is available for these packages.

Other labextensions (built into JupyterLab)
   app dir: /opt/conda/share/jupyter/lab

It seems the docker base image is not up to date and your stack is slightly newer.

If you look at the developer console, is there anything suspicious?
And if there isn't:
Do you think you could provide me or my team with temporary access to such an installation.

from yfiles-jupyter-graphs.

yGuy avatar yGuy commented on May 27, 2024

Maybe this comment or thread helps? matplotlib/ipympl#460 (comment)

from yfiles-jupyter-graphs.

luizbergertrustly avatar luizbergertrustly commented on May 27, 2024

I won't be able to share these installations, but it's the default environments of Sagemaker Notebooks, just some clicks to have it up and running.

I tried some procedures on this link, couldn't have it working.

There is other possible image, Amazon Linux 2, Jupyter Lab 1(notebook-al2-v1), which the Widget object can be created, but it simply does not render anything.

image

from yfiles-jupyter-graphs.

fskpf avatar fskpf commented on May 27, 2024

A similar issue was discussed here jupyter-widgets/ipywidgets#2220 with different solutions, all related to the setup of the environment.

Here as well https://forums.fast.ai/t/ipywidgets-not-displaying-on-aws-sagemaker-fastai/85039

And another discussion here: https://stackoverflow.com/questions/36351109/ipython-notebook-ipywidgets-does-not-show
Maybe something like this or that does the trick.

Seems like ipywidgets + sagemaker is a tricky setup.

from yfiles-jupyter-graphs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.