datalayer-examples / jupyter-nextjs-example

🪐 ⚛️ Jupyter Next.js example.
https://jupyter-ui.datalayer.tech
2 stars 1 forks source link

Running a cell doesn't do anything #3

Open davidgomes opened 6 months ago

davidgomes commented 6 months ago

https://github.com/datalayer-examples/jupyter-nextjs-example/assets/741621/849a61ec-297d-4eaf-9df0-348cabbf3106

I have cloned the repo and ran npm install and npm run dev but once the demo launches, running cells doesn't actually work (as per the attached video). No errors are printed in the console.

(I also had to run npm install raw-loader otherwise I get:

<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOENT: no such file or directory, rename '/Users/david/src/jupyter-nextjs-example/.next/cache/webpack/client-development-fallback/0.pack.gz_' -> '/Users/david/src/jupyter-nextjs-example/.next/cache/webpack/client-development-fallback/0.pack.gz'
 ⨯ ./node_modules/@datalayer/jupyter-react/lib/jupyter/lab/JupyterLabCss.js:48:1
Module not found: Can't resolve 'raw-loader'

)

davidgomes commented 6 months ago

One very easy way to reproduce this is by just using GitHub Codespaces.

yarn install
yarn add raw-loader
yarn dev

And then opening the demo.

davidgomes commented 6 months ago

I also tried https://github.com/datalayer/jupyter-ui/tree/main/examples/next-js and I get exactly the same outcome.

And I can reproduce both on Firefox or Chrome.

davidgomes commented 6 months ago

The only workaround I've found is pinning these dependencies backwards by 1 version each:

    "@datalayer/icons-react": "0.2.5",
    "@datalayer/jupyter-react": "0.9.8",
    "@datalayer/primer-addons": "0.2.3",
echarles commented 6 months ago

thx for reporting. raw-loader is needed indeed due to https://github.com/datalayer/jupyter-ui/pull/213 - I will add it in this repo and in the example tomorrow.

For the cell which does not run, I can not reproduce on my local env. It work with both the shift-enter in the cell, and via the left side menu.

I clearly see in your video the message "Requesting cell execution with cell executor" - I have never seen that... I will have a deeper look tomorrow.

davidgomes commented 6 months ago

@echarles when I first cloned this repo it worked for me as well. But then it stopped working. There’s something going on with dependency versions. I’d say the best surefire way to reproduce is by using GitHub Codespaces. You get a free fresh isolated environment there and it reproduces there.

echarles commented 6 months ago

Just pushed https://github.com/datalayer-examples/jupyter-nextjs-example/commit/6ef50c2cc63425918b0c385b09fb02cb543c89cb to add raw-loader and change the server url as per https://github.com/datalayer/jupyter-ui/issues/214

Tried also with codespace, but it uses yarn 1 which will not work, it needs yarn 3 (see https://jupyter-ui.datalayer.tech/docs/examples/next-js/ - this is a requirement from jupyterlab. npm has shown some success at some point, but we need to work more on that.

Trying now with a codesandbox.

Screenshot from 2024-05-13 07-51-17

echarles commented 6 months ago

@davidgomes I have created https://codesandbox.io/p/devbox/jupyter-react-nextjs-qzv8c - Build and run work fine with npm. The cell execution works on that codesanbox for me.

echarles commented 6 months ago

Sorry, the correct link is https://codesandbox.io/p/devbox/jupyter-react-nextjs-qzv8cz

davidgomes commented 5 months ago

Interesting @echarles, if you can't reproduce feel free to close this issue. I'll just stick with an older version of these packages for now.

echarles commented 5 months ago

Let's leave this open. It may be that you have a specific in your setup. Sticking to older versions in not good in the long term. Have you made changes to the code? Does you jupyter server/lab work fine?

davidgomes commented 5 months ago

Sorry I won't be able to test again for a while.

vipulsharma144 commented 4 months ago

primer-addons

I was facing the same issue in 0.10.0 .It works after downgrading jupyter-react to 0.9.8 .Thanks @davidgomes @echarles