neo4jupyter icon indicating copy to clipboard operation
neo4jupyter copied to clipboard

Jupyter Lab: neo4jupyter.init_notebook_mode() -> Javascript Error: require is not defined

Open pwrose opened this issue 5 years ago • 7 comments

neo4jupyter (v 0.1.2) doesn't seem to work in Jupyter Lab:

import neo4jupyter neo4jupyter.init_notebook_mode()

Javascript Error: require is not defined

pwrose avatar Feb 13 '20 07:02 pwrose

I'll check it out, thanks ! Can you check the jupyterlab version ?

merqurio avatar Feb 13 '20 10:02 merqurio

Thanks for looking into this. I'm using Jupyter Lab version 1.2.6.

I'm trying to visualize a knowledge graph I've created in this repo: https://github.com/sbl-sdsc/coronavirus-knowledge-graph

There is a Launch Binder link, so you can run the notebooks in your web browser if you've like to reproduce the issue.

On Thu, Feb 13, 2020 at 2:56 AM Gabi Maeztu [email protected] wrote:

I'll check it out, thanks ! Can you check the jupyterlab version ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/merqurio/neo4jupyter/issues/7?email_source=notifications&email_token=AA53AEEZ6PDREDVPWEPHVLTRCURLRA5CNFSM4KUL4DDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELUJPJA#issuecomment-585668516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA53AECGVOWFR7RO6FMYESLRCURLRANCNFSM4KUL4DDA .

pwrose avatar Feb 13 '20 19:02 pwrose

Thanks ! I'll try to check it this weekend

merqurio avatar Mar 04 '20 21:03 merqurio

@merqurio we are trying to use neo4jupyter for our coronavirus KG. If you have a chance, could you look into the 0.2.0 milestones? You could save a life!

pwrose avatar Mar 20 '20 23:03 pwrose

@pwrose Using jupyter notebook instead of jupyter lab may work

DoubleBite avatar Jun 11 '20 07:06 DoubleBite

Just ran into this myself. Turns out Jupyterlab does not include require.js while jupyter does. Jupyterlab folks didn't want developers using require.js to load dependencies, so they left it out and don't plan on adding it back. They recommended adding a lab extension. Someone did make a requirejs lab extension for jupyterlab but it only works on older versions.

Easy fix is to copy require.js to the same directory that has your ipynb file and then

%%HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js"></script>

in a cell before you

import neo4jupyter
neo4jupyter.init_notebook_mode()

Originally I thought you could copy the file locally and do the following to import it, but this does not work

%%HTML
<script src="require.js"></script>

bucweat avatar Jul 27 '20 20:07 bucweat