Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click on the course name in formgrader but does nothing #1888

Open
xinxin2v opened this issue May 26, 2024 · 9 comments
Open

Click on the course name in formgrader but does nothing #1888

xinxin2v opened this issue May 26, 2024 · 9 comments
Labels

Comments

@xinxin2v
Copy link

Operating system

   ubuntu 22 

nbgrader --version

nbgrader --version

Python version 3.9.17 (main, Jul 5 2023, 20:41:20)
[GCC 11.2.0]
nbgrader version 0.8.5

conda list |grep nbgrader

nbgrader 0.8.5 pyhd8ed1ab_0 conda-forge

jupyterhub --version (if used with JupyterHub)

root@jpserver:/usr/local/etc# conda list |grep nbgrader
nbgrader 0.8.5 pyhd8ed1ab_0 conda-forge
root@jpserver:/usr/local/etc# jupyterhub --version
4.1.5
root@jpserver:/usr/local/etc# conda list |grep jupyterhub
jupyterhub 4.1.5 pyh31011fe_0 conda-forge
jupyterhub-base 4.1.5 pyh31011fe_0 conda-forge

jupyter notebook --version

root@jpserver:/usr/local/etc# jupyter notebook --version
6.5.6
root@jpserver:/usr/local/etc# conda list |grep notebook
notebook 6.5.6 pyha770c72_0 conda-forge
notebook-shim 0.2.4 pyhd8ed1ab_0 conda-forge

Expected behavior

A notebook opens upon clicking onto the name of an assignment. (formgrader page and there managing assignments)
i login jupyterhub, switch to notebook, then open page of Manage Assignments , when i click on the course name in formgrader , then should open assignment folder

Actual behavior

I login jupyterhub, switch to notebook, then open page of Manage Assignments , when i click on the course name in formgrader but does nothing

Steps to reproduce the behavior

Have JupyterHub with nbgrader and one classes of ps1 setup.
Go to formgrader page and there managing assignments and add an assignment or try to use the preexisting ps1 that comes with the quickstart (following the demo-setup-steps for multiple classes).

issue

@xinxin2v
Copy link
Author

the step i install as follow
conda install -c conda-forge notebook=6.* jupyterhub configurable-http-proxy nodejs nbgrader=0.8*

I try to use other way, but also same issue
1 conda install -c conda-forge notebook=7* jupyterhub configurable-http-proxy nodejs nbgrader
2 conda install -c conda-forge --freeze-installed jupyter_contrib_nbextensions
the second command will downgrade notebook version to 6. then sane issue

@christina-seegers
Copy link

Did you look into this issue ( #1794 ). It might provide some insight.

@xinxin2v
Copy link
Author

xinxin2v commented Jun 8, 2024

Did you look into this issue ( #1794 ). It might provide some insight.

I see this Link, but didn't found solution. could you help provide more detail solution ?

And found following error. thanks in advance!

[SingleUserLabApp | WARNING] Skipping XSRF check for insecure request GET /user/vcm/formgraders
[SingleUserLabApp | INFO] 302 GET /user/vcm/formgrader/api/status -> /hub/api/oauth2/authorize?client_id=jupyterhub-user-vcm&redirect_uri=%2Fuser%2Fvcm%2Foauth_callback&response_type=code&state=[secret] (@10.200.31.89) 0.95ms
[SingleUserLabApp | ERROR] Couldn't decode response from local formgrader
[SingleUserLabApp | ERROR] Traceback (most recent call last):
File "/home/conda3/lib/python3.12/site-packages/nbgrader/server_extensions/course_list/handlers.py", line 70, in check_for_local_formgrader
response = json.loads(response.body.decode())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/conda3/lib/python3.12/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/conda3/lib/python3.12/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/conda3/lib/python3.12/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

@christina-seegers
Copy link

Sorry but I never found a real solution. I try with jupyterlab (so you-jupyterhub.sth/user/username/lab) but than I ran into some other issues with nbgrader, so I am not sure if this is a solution. The ananke project might include a solution (https://github.com/jeflem/ananke/tree/main), but again I can't provide more than the link.

@shreve
Copy link
Contributor

shreve commented Jul 3, 2024

The source of problem is that when you're using JupyterLab, the formgrader page expects to be inside an iframe, and thus changes it's click handler. When you're in the notebook, the link is a normal <a href="..."> that takes you to the assignment directory. When you're in the lab, the link uses window.parent.postMessage to tell the outer lab frame to navigate to the assignment directory.

The issue in my opinion is two-fold:

  1. When the formgrader page is opened directly as you have it in your screenshot, window.parent doesn't exist, so this link does nothing. The handler should be more aware of whether there is a parent.
  2. The way nbgrader determines if you're using JupyterLab or not is to see whether you've run the server using jupyter-notebook. This feels too naïve to rely on for things like this.
    # Save which kind of application is running : Jupyterlab like or classic Notebook
    webapp.settings['is_jlab'] = not (nbapp.name == 'jupyter-notebook')

@brichet I would consider this a bug.

@brichet brichet added the bug label Jul 5, 2024
@brichet
Copy link
Contributor

brichet commented Jul 5, 2024

Thanks @shreve for the details.

I agree that this test is naïve, do you have an idea how to make it more robust ?

What I don't understand is why the formgrader is served by jupyterlab if the intention is to use notebook 6.

@xinxin2v:

  • do you have jupyterlab installed ?
  • is jupyter notebook working ?
  • can you open formgrader from the notebook tree page ?

@xinxin2v
Copy link
Author

Thanks @shreve for the details.

I agree that this test is naïve, do you have an idea how to make it more robust ?

What I don't understand is why the formgrader is served by jupyterlab if the intention is to use notebook 6.

@xinxin2v:

  • do you have jupyterlab installed ?
  • is jupyter notebook working ?
  • can you open formgrader from the notebook tree page ?

1 No, Only installed jupyternotebook.
2 yes, jupyter notebook working
3 yes , i can open formgrader from the notebook tree page

@shreve
Copy link
Contributor

shreve commented Jul 12, 2024

@brichet

What I don't understand is why the formgrader is served by jupyterlab if the intention is to use notebook 6.

@xinxin2v Reported that they're running from JupyterHub, which uses jupyter-singleuser, which is really just jupyter-server under the hood. This is a situation where only notebook is installed, not jupyterlab, but it still results in is_jlab being true because jupyter_server's ServerApp(JupyterApp) has name = "jupyter-server", even for notebook~=6 and jupyter_server~=1.

The fix is to check the environment the page is running in and use navigation that makes sense in that context. In the PR I just issued, I got rid of is_lab in favor of more specific decision making in each of its use cases.

@brichet
Copy link
Contributor

brichet commented Jul 12, 2024

OK, thanks for the clarification @shreve, I didn't know that notebook < 7 ran with jupyter_server instead of notebook_server in some situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants