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

jupyterhub: hub-wide installation and/or hub compatibility #35

Open
jlphillipsphd opened this issue Jan 21, 2018 · 5 comments
Open

jupyterhub: hub-wide installation and/or hub compatibility #35

jlphillipsphd opened this issue Jan 21, 2018 · 5 comments

Comments

@jlphillipsphd
Copy link
Contributor

I have a jupyterhub installation serving single-user notebooks (wonderful tools!), and would like to have everyone be able to use cite2c for inline citations in their notebooks.

I guess my short question would be: Looking at the install.py script, it looks like it's only able to install for the local user? Is there any known way to install for all users under jupyterhub?

I realize they may need some local files installed in their accounts (like .cls files and such that are installed with zotero - which I have done for one user account for testing purposes). However, the handlers still don't seem to be working properly. Even if I use "python -m cite2c.install" as that user, the cite2c/zotero_oauth page doesn't load and results in a 404 response. I can get a little farther if I manually set up the cite2c.json file with my credentials, but the search gui isn't displaying correctly, and (even though I can get it to read my library, and insert the correct tag information) the citations don't get rendered inline nor in the bibliography. I don't understand the software enough to make any more headway at the moment, but if there are any suggestions on what might need to be altered, I might be able to make some more progress.

Sorry if this has already been addressed before, but I couldn't find any mention of cite2c being used with jupyterhub anywhere.

@jlphillipsphd
Copy link
Contributor Author

jlphillipsphd commented Jan 21, 2018

One more thing: I can see in install.py that the user=True option is used throughout. Would a simple user=False option probably make this work?

Edit: Tried the above and installed via flit. Looks like the python bits started working now, so the cite2c/zotero_oauth now works! However, the rendering problems remain, and it appears that most of the js files are being requested at server root url (/) instead of using 'base_url' (which seems to be fine for the python scripts). For example, /nbextension is being used instead of /my/hub/user/uid/nbextension. So, I guess the question would be: what would I use in the js parts of the extension to get that url, or is that even possible? I would like to prepend that onto the jquery/ajax requests so that the other files (.css and .js) can be used.

Getting close now, any help would be greatly appreciated.

@takluyver
Copy link
Owner

Hi, you're the first person I've heard from trying to install cite2c with Jupyterhub - I'm excited to see it being used for a group like that.

The short answer is that I think modifying the install functions to use user=False should do what you need, so long as all your users are on the same filesystem (not in e.g. docker containers).

(If the users are in docker containers, then I expect it's just a case of installing and enabling cite2c inside the docker container)

There are four pieces I can think of that need to be in place for cite2c to work:

  • The Python package cite2c needs to be somewhere that the users individual notebook server can import it. This is what pip typically takes care of. Depend on how your single user servers are set up, there may be a shared directory that you can install it in, or you might need to install it for every user.
  • The cite2c/nbext subfolder needs to be copied to an nbextensions directory called cite2c. If your users are working on the same filesystem, it can go in /usr/local/share/jupyter/nbextensions/cite2c (see the 'data' section on jupyter --paths for the list of places it looks for nbextensions).
  • The server config needs to tell the server to load the cite2c.handlers module as an extension. There's some extra code (merge nbserver_extensions jupyter/notebook#2108) so extensions can be specified systemwide without system and user config clashing.
  • The frontend config needs to tell the Javascript to load cite2c/main for the nbextension part of cite2c.

@jlphillipsphd
Copy link
Contributor Author

jlphillipsphd commented Jan 22, 2018

Thanks for the info, I'll definitely be using it moving forward.

I made some progress getting cite2c to work with JupyterHub so that the extension can at least now be installed by each user locally. There were a couple of changes necessary to get it work, and those can be found here: #36
With the update, and with cite2c installed alongside JupyterHub, users are able to run 'python -m cite2c.install' from a terminal to activate the extension on a case-by-case basis.

I have not yet had luck getting the system-wide install to work. Setting user=False in the installation script seemed easy enough, but the files get copied to /usr/local/ instead of where the jupyterhub shared files seem to be located (I am using virtualenv). However, I will keep working on this and hopefully have something to contribute back soon...

@jlphillipsphd
Copy link
Contributor Author

Given that I am also running JupyterLab on the same JupyterHub installation and that I am happy with the current way that cite2c works with JupyterHub now, I am thinking that putting more time into making cite2c compatible with JupyterLab/Hub might be a better use of time instead of the standard notebook server.

Currently, users can visit the standard server at /tree and use cite2c, but JupyterLab is just out of luck for now -> citations do not render (but that's pretty much expected since cite2c isn't compatible with JupyterLab yet).

Any thoughts or concerns about this?

@TS-CUBED
Copy link

TS-CUBED commented Jun 25, 2019

Thanks for this plugin.

I use cite2c in jupyter notebook, and have tried to get it to work in jupyterhub. Reading this thread I thought the problems were fixed, but while I can get it installed and started, I do get the layout and (not) rendering problems mentioned in this thread:
Installation issues:

  • jupyter notebook installation does not carry over to the spawned notebook servers, need to repeat cite2c installation for the jupyterhub user from within the spawned server (not sure why, but if that's required I can live with that).

After that the cite2c extension is loaded and shows the icons, but:

  • On first start it tries to connect to Zotero for authentication, but the link points to a file:// address -> error 404, I can solve this by copying the zotero auth file from the earlier installation manually (no problem)
  • cite2c starts, but the search window expands the list of references into a very narrow sliver.
  • inserting a reference will create the cite tags and the bibliography can be inserted and creates the proper code as well. However, it does not render anything. Seems that citeproc isn't called correctly.

Should this work, or have I misinterpreted jlphillipsphd: "... and that I am happy with the current way that cite2c works with JupyterHub now,.." and it still only works in jupyter notebook? Or is my installation broken?

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

No branches or pull requests

3 participants