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

unable to fetch assignments #776

Closed
kxiluri opened this issue Jun 27, 2017 · 38 comments
Closed

unable to fetch assignments #776

kxiluri opened this issue Jun 27, 2017 · 38 comments
Labels
Milestone

Comments

@kxiluri
Copy link

kxiluri commented Jun 27, 2017

Good morning
i would really appreciate help as i have a summer class and the students can not fetch assingments

1)nbgrader --version
nbgrader version 0.4.0
on the command line
nbgrader fetch aewk1 !this one works
2)jupyter notebook
in the assignment Tab, i see the assignment, but when i click Fetch i get
NotebookApp] 403 POST /assignments/fetch (::1): '_xsrf' argument missing from POST
3)on the jupyter hub it also fails

many thanks and kind regards
kiriaki

@jhamrick
Copy link
Member

Hmm, this should have been fixed by #593 , and I can't reproduce it on a clean install of nbgrader. It is possible, perhaps, that you are using an old version of the extension. Can you try running the following command:

jupyter nbextension install --sys-prefix --overwrite --py nbgrader

And then restarting the Jupyter server? Does the problem still persist?

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

Thank you for your prompt reply, much appreciated. i am not sure what #593 tells me to do
is it the ajax version? the server is overseas and they are teaching, i have to wait till they are off,
but thanks for the reply

@jhamrick
Copy link
Member

#593 does not tell you to do anything---what you're reporting is a legitimate bug, but it was fixed by #593 so that leads me to believe your extension code is out-of-date (i.e., the bugfix is not in the version of the extension you're using). So hopefully updating the version of the extension (by running the command I sent) will fix the problem.

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

I have a test server here, which is a clone of the live server, just before the time the prof created and released assignments. But other than that, the two servers are the same. On the clone server i do
jupyter nbextension install --sys-prefix --overwrite --py nbgrader
and get at the end
KeyError: 'The Python module nbgrader is not a valid nbextension, it is missing the _jupyter_nbextension_paths() method.

the traceback looks like
Traceback (most recent call last):
File "/usr/local/bin/jupyter-nbextension", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.4/dist-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)

anaconda is looking at
/usr/local/anaconda3/lib/python3.5
i installed with
conda install -c conda-forge nbgrader

any help would be much appreciated, sorry for all this
kiriaki

@jhamrick
Copy link
Member

It looks like you have two different versions of python on your test server that are conflicting with each other, as evidenced by the path from the traceback (/usr/local/lib/python3.4) versus the one you say anaconda is looking at (/usr/local/anaconda3/lib/python3.5). My guess is that you have an older version of nbgrader installed into /usr/local/lib/python3.4.

Can you try the following:

  1. Close your terminal and open a new one.
  2. Run the command which jupyter and paste the output here.
  3. Run the command which nbgrader and paste the output here.
  4. Run the command echo $PATH and paste the output here.

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

thank you SO much
on the test server as user kiriaki
which jupyter
/usr/local/anaconda3/bin/jupyter
which nbgrader
/usr/local/anaconda3/bin/nbgrader
echo $PATH
/home/kiriaki/.local/share/jupyter/nbextensions/livereveal:/usr/local/gamit/com:/usr/local/gamit/kf/bin:/usr/local/gamit/gamit/bin:/usr/local/gmt/bin:/usr/local/anaconda3/lib/python3.5:/usr/local/anaconda3/bin:/usr/local/GMT5SAR/bin:/usr/local/gmt//bin:/usr/local/gamit/com:/usr/local/gamit/kf/bin:/usr/local/gamit/gamit/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

however i start jupyter as a service rc.local as follows
export PATH="$PATH:/usr/local/bin:/usr/lib/python3.4:/usr/lib/python3.4/plat-x86_64-linux-gnu:/usr/lib/python3.4/lib-dynload:/usr/local/lib/python3.4/dist-
packages:/usr/lib/python3/dist-packages:/usr/local/anaconda3/lib/python3.5:/usr/local/anaconda3/lib/python3.5/site-packages"
/usr/local/bin/jupyterhub -f /home/kiriaki/jupyterhub/jupyterhub_config.py >> /var/log/rc.local.log 2>&1

@jhamrick
Copy link
Member

Ok, does it work to do:

/usr/local/anaconda3/bin/jupyter nbextension install --sys-prefix --overwrite --py nbgrader

Additionally, you should make sure the path you use to start your jupyterhub service has the anaconda directory at the beginning of the path, and to launch jupyterhub from your anaconda distribution, i.e.

export PATH="$PATH:/usr/local/anaconda3/lib/python3.5:/usr/local/anaconda3/lib/python3.5/site-packages:/usr/local/bin:/usr/lib/python3.4:/usr/lib/python3.4/plat-x86_64-linux-gnu:/usr/lib/python3.4/lib-dynload:/usr/local/lib/python3.4/dist-packages:/usr/lib/python3/dist-packages"
/usr/local/anaconda3/bin/jupyterhub -f /home/kiriaki/jupyterhub/jupyterhub_config.py >> /var/log/rc.local.log 2>&1

Also, would you mind pasting your commands/output using markdown backticks, ```like this```? It makes it much easier to read, thanks!

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

thank you and my apologies for the markdown
on the clone server i do
sudo /usr/local/anaconda3/bin/jupyter nbextension install --sys-prefix --overwrite --py nbgrader
and it seems to have worked with

Removing: /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list
Making directory: /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/__init__.py -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/__init__.py
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/main.js -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/main.js
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/handlers.py -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/handlers.py
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/assignment_list.js -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/assignment_list.js
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/assignment_list.css -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/assignment_list.css
Making directory: /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/static
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/static/main.js -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/static/main.js
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/static/assignment_list.js -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/static/assignment_list.js
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/static/assignment_list.css -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/static/assignment_list.css
Making directory: /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/__pycache__
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/__pycache__/__init__.cpython-35.pyc -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/__pycache__/__init__.cpython-35.pyc
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/assignment_list/__pycache__/handlers.cpython-35.pyc -> /usr/local/anaconda3/share/jupyter/nbextensions/assignment_list/__pycache__/handlers.cpython-35.pyc
- Validating: OK
Installing /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/create_assignment -> create_assignment
Removing: /usr/local/anaconda3/share/jupyter/nbextensions/create_assignment
Making directory: /usr/local/anaconda3/share/jupyter/nbextensions/create_assignment/
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/create_assignment/create_assignment.css -> /usr/local/anaconda3/share/jupyter/nbextensions/create_assignment/create_assignment.css
Copying: /usr/local/anaconda3/lib/python3.5/site-packages/nbgrader/nbextensions/create_assignment/main.js -> /usr/local/anaconda3/share/jupyter/nbextensions/create_assignment/main.js
- Validating: OK

    To initialize this nbextension in the browser every time the notebook (or other app) loads:

          jupyter nbextension enable nbgrader --py --sys-prefix

i am not sure how to continue though

@jhamrick
Copy link
Member

Does fetching now work, or do you still get the same error?

@jhamrick
Copy link
Member

(Note: make sure you have restarted jupyterhub)

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

thank you
unfortunately, i tried this on the clone, where there are no assignments to try.
the live server will not be available for at lest 3 more hours and i can not reboot it. i have test users on the live server though.

@jhamrick
Copy link
Member

You can test on your test server using the assignments created by nbgrader quickstart:

$ cd /tmp
$ nbgrader quickstart testcourse
$ cd testcourse
$ nbgrader assign ps1
$ nbgrader release ps1

Then test fetching ps1 from testcourse using the assignment list extension.

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

thank you
as what user do i do this procedure?
so sorry but even sudo gives Unwritable directory at the last step

@jhamrick
Copy link
Member

You can do it with your regular user. The exchange directory (by default /srv/nbgrader/exchange) has to be writeable by all users; you can check the permissions with:

ls -l /srv/nbgrader/exchange

And if they are not correct run:

chmod ugo+rw /srv/nbgrader/exchange

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

after rebooting the test server, oddly enough, i see the assignments from a year ago, but when i try to fetch them i get the same error, namely Error fetching assignment. I do not see the ps1 though.

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

ok now i need more help, i am on the actual server. i do
sudo /usr/local/anaconda3/bin/jupyter nbextension install --sys-prefix --overwrite --py nbgrader
and get

[sudo] password for kiriaki:
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-nbextension", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/dist-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/usr/local/lib/python3.4/dist-packages/notebook/nbextensions.py", line 900, in start
    super(NBExtensionApp, self).start()
  File "/usr/local/lib/python3.4/dist-packages/jupyter_core/application.py", line 256, in start
    self.subapp.start()
  File "/usr/local/lib/python3.4/dist-packages/notebook/nbextensions.py", line 678, in start
    self.install_extensions()
  File "/usr/local/lib/python3.4/dist-packages/notebook/nbextensions.py", line 657, in install_extensions
    **kwargs
  File "/usr/local/lib/python3.4/dist-packages/notebook/nbextensions.py", line 211, in install_nbextension_python
    m, nbexts = _get_nbextension_metadata(module)
  File "/usr/local/lib/python3.4/dist-packages/notebook/nbextensions.py", line 1037, in _get_nbextension_metadata
    'it is missing the `_jupyter_nbextension_paths()` method.'.format(module))
KeyError: 'The Python module nbgrader is not a valid nbextension, it is missing the `_jupyter_nbextension_paths()` method.'

what am i missing here

@jhamrick
Copy link
Member

Let's try to get this working on your test server before the live server just so we don't mess anything up there. Also, that error is the same one you got before, which suggests you have multiple versions of nbgrader installed.


On your test server, try upgrading nbgrader and the extension that's installed in your python3.4 installation too.

/usr/local/bin/pip install -U nbgrader
/usr/local/bin/jupyter nbextension install --sys-prefix --overwrite --py nbgrader

Then test whether fetch works.

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

i appreciate your patience with me.
on the test server

sudo /usr/local/bin/jupyter nbextension install --sys-prefix --overwrite --py nbgrader```

then i rebooted this test server, i have updated the PATH as previously

then as user kiriaki
cd /tmp
nbgrader quickstart testcourse
cd testcourse
nbgrader assign ps1
nbgrader release ps1 --force
and now when i login to jupyter on that server and go to Assignement tabl
i do not see any assignments at all

@jhamrick
Copy link
Member

Are there errors in the javascript console or in the output of jupyterhub?

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

on the test server as user kiriaki from the command line i do
nbrader fetch ps1
FetchApp | ERROR] Assignment not found: /share/class_2016/outbound/ps1
i am not sure how i did that?

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

the java console says

assignment list.jsv=2xxx   main.min.js```
 and then
```  Object{readyState: 4, getResponseHeader: function, get AllResponseHeaders;function, ...}
API request failed (404) Not Found```

@jhamrick
Copy link
Member

When you released the assignment with nbgrader quickstart, you might have released it to the default exchange directory (/srv/nbgrader/exchange) rather than the custom one you seem to have set (/share/class_2016/outbound/ps1). Try fixing the nbgrader_config.py that was created as part of quickstart and then re-release the assignment. It should hopefully show up now.

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

i edited the exchange directory to be /share/class_2016/outbound

ReleaseApp | INFO] Source: /home/kiriaki/testcourse/release/./ps1
[ReleaseApp | INFO] Destination: /share/class_2016/outbound/testcourse/outbound/ps1
[ReleaseApp | INFO] Released as: testcourse ps1``
and then
```nbgrader fetch ps1
[FetchApp | INFO] Source: /share/class_2016/outbound/testcourse/outbound/ps1
[FetchApp | INFO] Destination: /home/kiriaki/testcourse/ps1
[FetchApp | INFO] Fetched as: testcourse ps1

but through the jupyter hub i still get the same error on the javascript console namely
404 Not found

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

sonora

here is a snapshot of the javascript

@jhamrick
Copy link
Member

What is the output of:

/usr/local/bin/jupyter serverextension list

and

/usr/local/bin/jupyter nbextension list

?

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

Failed to import the site module
Traceback (most recent call last):
  File "/usr/local/anaconda3/lib/python3.5/site.py", line 72, in <module>
    import os
  File "/usr/local/anaconda3/lib/python3.5/os.py", line 664, in <module>
    from _collections_abc import MutableMapping
  File "/usr/local/anaconda3/lib/python3.5/_collections_abc.py", line 56
    async def _coro(): pass
            ^
SyntaxError: invalid syntax
kiriaki@localhost:~$ /usr/local/bin/jupyter nbextension list
Failed to import the site module
Traceback (most recent call last):
  File "/usr/local/anaconda3/lib/python3.5/site.py", line 72, in <module>
    import os
  File "/usr/local/anaconda3/lib/python3.5/os.py", line 664, in <module>
    from _collections_abc import MutableMapping
  File "/usr/local/anaconda3/lib/python3.5/_collections_abc.py", line 56
    async def _coro(): pass
            ^
SyntaxError: invalid syntax

@kxiluri
Copy link
Author

kxiluri commented Jun 27, 2017

kiriaki@localhost:~$ /usr/local/anaconda3/bin/jupyter nbextension list
Known nbextensions:
  config dir: /home/kiriaki/.jupyter/nbconfig
    notebook section
      calico-spell-check  enabled
      - Validating: OK
      create_assignment/main  enabled
      - Validating: OK
      livereveal/main  enabled
      - Validating: OK
      jupyter-js-widgets/extension  enabled
      - Validating: OK
    tree section
      assignment_list/main  enabled
      - Validating: OK
  config dir: /usr/local/anaconda3/etc/jupyter/nbconfig
    notebook section
      create_assignment/main  enabled
      - Validating: OK
    tree section
      assignment_list/main  enabled
      - Validating: OK

@jhamrick
Copy link
Member

Umm... hmm. Ok. It seems like you have some very severe issues going on with your two installations of python conflicting. It is generally a good idea to only use one way of installing python otherwise you can end up in situations like this 😞

I think you need to make a decision about whether you want to use anaconda or not, and then stick with that for everything. For example, if you decide you want to use anaconda, then uninstall nbgrader, jupyterhub, and jupyter from your system python, and then reinstall them with anaconda python:

/usr/local/bin/pip uninstall nbgrader jupyter jupyterhub
/usr/local/anaconda3/bin/pip install -U nbgrader jupyter jupyterhub
/usr/local/anaconda3/bin/jupyter nbextension install --overwrite --sys-prefix --py nbgrader
/usr/local/anaconda3/bin/jupyter nbextension enable --sys-prefix --py nbgrader
/usr/local/anaconda3/bin/jupyter serverextension enable --sys-prefix --py nbgrader

Then, make sure the /usr/local/anaconda3/bin is the first thing in your $PATH.

Alternately, if you want to use your system python, then uninstall nbgrader, jupyter, and jupyterhub from your anaconda installation and reinstall them with system python:

/usr/local/anaconda3/bin/pip uninstall nbgrader jupyter jupyterhub
/usr/local/bin/pip install -U nbgrader jupyter jupyterhub
/usr/local/bin/jupyter nbextension install --overwrite --sys-prefix --py nbgrader
/usr/local/bin/jupyter nbextension enable --sys-prefix --py nbgrader
/usr/local/bin/jupyter serverextension enable --sys-prefix --py nbgrader

Then, make sure anaconda isn't anywhere on your $PATH.

@kxiluri
Copy link
Author

kxiluri commented Jun 28, 2017

on the server
i have a test student, i see the assignment but when i try to fetch it the javaconsole says
403 Forbiden. could you please take a look
strato

@jhamrick
Copy link
Member

Did you follow my suggestion in the previous comment, about choosing one or the other of anaconda or the local installation? Which did you choose?

Are there any error messages in the JupyterHub output?

@kxiluri
Copy link
Author

kxiluri commented Jun 28, 2017

Thank you very much.
On the test server i have jupyter hub starting with the anaconda jupyterhub in the rc.local
root which nbgrader points to the anaconda3 one, which jupyter to anaconda3, which jupyterhub to anaconda

/usr/local/anaconda3/bin/jupyter nbextension install --system --overwrite --py nbgrader
/usr/local/anaconda3/bin/jupyter nbxtension enable --system --py nbgrader
/usr/local/anaconda3/bin/jupyter serverextension enable --system --py nbgrader

i then logged in as kiriaki and sure enough i can see the ps1 assignment on the ASSIGNMENTs tab

@jhamrick
Copy link
Member

Great, I'm glad it seems to be working now!

I'd recommend taking the same steps on the live server (though I would probably back up your assignments and your students' files, just in case). Make sure you're only using one installation of python, with all of nbgrader, jupyter, and jupyterhub pointing to that installation. Make sure nbgrader is up-to-date, and then reinstall the nbextensions.

@kxiluri
Copy link
Author

kxiluri commented Jun 28, 2017

on the test server what do i need to do so that another user can see the Assignment ps1,
i did as follows but student4 can not see ps1

1)in the nbgrader_config.py i added student4 in the NbGrader.db_students
2)on the /home/student4 i added a nbgrader_config.py like so

c = get_config()

c.NbGrader.course_id = "testcourse"
c.TransferApp.exchange_directory = "/share/class_2016/outbound"

@jhamrick
Copy link
Member

Is this is the same 403 forbidden error from before? If so, please let me know if there are any errors from the output of JupyterHub as I requested earlier. If not, please check both the javascript console and the JupyterHub output and report if there are any errors.

In general it would be helpful if when things aren't working, you always checked these two things and reported any errors. I usually can't debug something just by knowing it isn't working; I need to know some more context about what the errors are and where they are coming from. Thanks!

@kxiluri
Copy link
Author

kxiluri commented Jun 28, 2017

on the test server student4 now works. the problem is that student4 looks at the /usr/local/bin/
not at /usr/local/anaconda3/bin. when i did i was able to as student4 to fetch a ps1 assingment

    /usr/local/anaconda3/bin/jupyter nbextension enable --user --py nbgrader
  /usr/local/anaconda3/bin/jupyter serverextension enable --user --py nbgrader

@kxiluri
Copy link
Author

kxiluri commented Jun 30, 2017

Sorry for the silence, i just got access to yet another clone of the server and even though i fixed the nbextension, other things broke. I will see what i can do, but i wanted to say thank you.

@jhamrick
Copy link
Member

jhamrick commented Jul 6, 2017

Glad to hear you got the nbextension working, though sorry to hear other things broke! I am going to close this issue since this specifically seems to be resolved, but feel free to open another if you encounter further problems.

@jhamrick jhamrick closed this as completed Jul 6, 2017
@jhamrick jhamrick added this to the No action milestone Jul 6, 2017
@kxiluri
Copy link
Author

kxiluri commented Jul 6, 2017

Thank you very much. The moral of the story is to stick with either pip or anaconda if possible

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

2 participants