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

Incompatible with jupyter-labhub #235

Closed
fritterhoff opened this issue Nov 22, 2021 · 12 comments · Fixed by #240 or #255
Closed

Incompatible with jupyter-labhub #235

fritterhoff opened this issue Nov 22, 2021 · 12 comments · Fixed by #240 or #255
Labels

Comments

@fritterhoff
Copy link

Bug description

As soon as I try to use a nbgitpuller Link with the jupyter-labhub Backend I only get a "Internal Server Error" and some errors in the logs. Using the "normal" backend works fine.

Expected behaviour

Normal cloning of the repo.

Actual behaviour

HTTP Status 500

How to reproduce

Start single user nb with jupyter-labhub and try to open a nbgitpuller link

Your personal set up

  • Logs
[E 2021-11-22 19:03:55.343 SingleUserLabApp web:1789] Uncaught exception GET ***Redacted***', version='HTTP/1.1', remote_ip='')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.9/site-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/opt/conda/lib/python3.9/site-packages/tornado/gen.py", line 216, in wrapper
        result = ctx_run(func, *args, **kwargs)
      File "/opt/conda/lib/python3.9/site-packages/nbgitpuller/handlers.py", line 175, in get
        self.render_template(
      File "/opt/conda/lib/python3.9/site-packages/notebook/base/handlers.py", line 515, in render_template
        template = self.get_template(name)
      File "/opt/conda/lib/python3.9/site-packages/nbclassic/nbserver.py", line 140, in get_template
        return self.settings['notebook_jinja2_env'].get_template(name)
      File "/opt/conda/lib/python3.9/site-packages/jinja2/environment.py", line 997, in get_template
        return self._load_template(name, globals)
      File "/opt/conda/lib/python3.9/site-packages/jinja2/environment.py", line 958, in _load_template
        template = self.loader.load(self, name, self.make_globals(globals))
      File "/opt/conda/lib/python3.9/site-packages/jinja2/loaders.py", line 125, in load
        source, filename, uptodate = self.get_source(environment, name)
      File "/opt/conda/lib/python3.9/site-packages/jinja2/loaders.py", line 214, in get_source
        raise TemplateNotFound(template)
    jinja2.exceptions.TemplateNotFound: status.html
@welcome
Copy link

welcome bot commented Nov 22, 2021

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@fritterhoff
Copy link
Author

Just as a hint/comment: Copying the (missing) status.html solves the problem temporary. In detail I had to run cp /opt/conda/lib/python3.9/site-packages/nbgitpuller/templates/status.html /opt/conda/lib/python3.9/site-packages/notebook/templates/status.html

@fritterhoff
Copy link
Author

Anyone an idea how to fix that?

@yuvipanda
Copy link
Contributor

@fritterhoff what version of nbgitpuller are you using? We fixed this for v1.0 I think.

@fritterhoff
Copy link
Author

Hi @yuvipanda
I'm using v1.0.2
grafik

@a3626a
Copy link
Contributor

a3626a commented Dec 27, 2021

This bug is reproducible with this docker image

@manics
Copy link
Member

manics commented Dec 28, 2021

Could you both show us your full JupyterHub configuration with secrets redacted, and also show the output of pip list for your JupyterHub and singleuser environments?

@fritterhoff
Copy link
Author

fritterhoff commented Dec 29, 2021

@manics Well that could get complicated as I use it via zero-to-jupyterhub-k8s ...
I'll try to reproduce the issue using a normal jupyterhub and the minimum required settings.

@fritterhoff
Copy link
Author

So I'm able to provide some instructions to reproduce the bug:

  1. Build a docker image using the following content as Dockerfile
FROM jupyter/scipy-notebook:2021-12-16
USER root

RUN pip install --no-cache-dir nbgitpuller && \
    fix-permissions "${CONDA_DIR}" && \
    fix-permissions "/home/${NB_USER}" 

USER ${NB_USER}

or even more simple:

FROM jupyter/scipy-notebook:2021-12-16

RUN pip install --no-cache-dir nbgitpuller
  1. Run the docker image using docker run --rm -it -p 8888:8888 test jupyter lab (replace the image name with your own)
  2. Try to open the jupyterlab using the printed link and afterwards try to pull a git repo (e.g. http://127.0.0.1:8888/git-pull?repo=https%3A%2F%2Fgithub.com%2Fjupyterhub%2Fnbgitpuller&urlpath=lab%2Ftree%2Fnbgitpuller%2F&branch=main)
  3. You should now see the error message in terminal where you started the jupyter lab

@manics
Copy link
Member

manics commented Jan 3, 2022

@fritterhoff thanks for digging into the problem, and providing a minimal example! It looks like there's a mix of notebook and jupyter-server, I think this should fix it:
#240

@ianabc
Copy link

ianabc commented Jan 6, 2022

#240 does indeed seem to fix this in my case. Thank you!

@betolink
Copy link

betolink commented Mar 9, 2022

I ran into this today and tried to install nbgitpuller from https://github.com/manics/nbgitpuller/tree/jupyter-server but didn't fix the issue. Debugging locally I get the same error:

ServerApp - ERROR - Uncaught exception GET /git-pull?repo=https%3A%2F%2Fgithub.com%2FNASA-Openscapes%2Fearthdata-cloud-cookbook&urlpath=lab%2Ftree%2Fearthdata-cloud-cookbook%2Fexamples%2F&branch=ux-exercise (172.17.0.1)
HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='GET', uri='/git-pull?repo=https%3A%2F%2Fgithub.com%2FNASA-Openscapes%2Fearthdata-cloud-cookbook&urlpath=lab%2Ftree%2Fearthdata-cloud-cookbook%2Fexamples%2F&branch=ux-exercise', version='HTTP/1.1', remote_ip='172.17.0.1')
Traceback (most recent call last):
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/tornado/web.py", line 1704, in _execute
    result = await result
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/tornado/gen.py", line 216, in wrapper
    result = ctx_run(func, *args, **kwargs)
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/nbgitpuller/handlers.py", line 175, in get
    self.render_template(
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/notebook/base/handlers.py", line 515, in render_template
    template = self.get_template(name)
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/nbclassic/nbserver.py", line 140, in get_template
    return self.settings['notebook_jinja2_env'].get_template(name)
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/jinja2/environment.py", line 997, in get_template
    return self._load_template(name, globals)
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/jinja2/environment.py", line 958, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/jinja2/loaders.py", line 125, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "/srv/conda/envs/notebook/lib/python3.9/site-packages/jinja2/loaders.py", line 214, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: status.html

yuvipanda added a commit to yuvipanda/nbgitpuller that referenced this issue Mar 16, 2022
- Our template loader setup was a hack, and that hack seems to
  have stopped working.
- We just use our own loader instead. This means we lose the base
  translation functionality of upstream render_template - but we
  were not using it at all anyway, so 'tis alright.
- Looks like the path for the stylesheet we were 'borrowing'
  from classic notebook changed location, so update to use the
  new location. This will stop existing after notebook v7,
  and we will need to use our own.

Fixes jupyterhub#235
TimoRoth added a commit to OGGM/r2d that referenced this issue Mar 19, 2022
TomAugspurger added a commit to microsoft/planetary-computer-containers that referenced this issue Jun 23, 2022
Currently, our "Launch in Hub" button is throwing a 500 error, possibly
because of jupyterhub/nbgitpuller#235. This
updates nbgitpuller to a version with a fix for that issue.
TomAugspurger added a commit to microsoft/planetary-computer-containers that referenced this issue Jun 23, 2022
Currently, our "Launch in Hub" button is throwing a 500 error, possibly
because of jupyterhub/nbgitpuller#235. This
updates nbgitpuller to a version with a fix for that issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants