mamba-org / gator

Conda environment and package management extension from within Jupyter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conda tab in classical notebook pod spawned from Jupyterhub has unwanted warnings.

HCharlie opened this issue · comments

Description

In the classical notebook server(pod) spawned from Jupyterhub, when I click the Conda tab, it will pop up a warning window telling me an error An error occurred while retrieving package information.
Screen Shot 2020-06-29 at 10 34 55 PM

Reproduce

I was following Zero to JupyterHub with Kubernetes(https://zero-to-jupyterhub.readthedocs.io/en/latest/index.html) and using KIND(https://kind.sigs.k8s.io/docs/user/quick-start/) to set up the k8s cluster.

And the singleuser image I use is base-notebook from docker-stacks(https://github.com/jupyter/docker-stacks/blob/master/base-notebook/Dockerfile) with modification only to install jupyter_conda package.

After everything is setup. Just go to classical notebook and click Conda tab, you would see the window pop up.

Expected behavior

No warning shows up.

Context

  • Helm chart version:
    Jupyterhub: 0.8.2
  • Python package version:
    jupyter_conda: latest

What I see

b0231e00-ba21-11ea-9887-7869b1ac8067

in which test.hub.kind.test 127.0.0.1 in /etc/hosts

the request URL somehow end up with /hub/conda/task/... instead of /user/username/conda/task/... with which using wget will not give 404 code.

@HCharlie Thanks for reporting the error. The redirection url is used there (for the classical notebook): https://github.com/fcollonval/jupyter_conda/blob/master/jupyter_conda/static/models.js#L138

I have never seen an error before - but I'm not using JHub often - and certainly not on Kubernetes unfortunately.

The redirected url is built on that line: https://github.com/fcollonval/jupyter_conda/blob/master/jupyter_conda/handlers.py#L141

As you can see it is only partial. Could you test the following change on jupyter_conda/static/models.js#L138:

-             xhr.getResponseHeader("Location") || url,
+             (urls.base_url + xhr.getResponseHeader("Location")) || url,

@fcollonval Thanks for your reply. And unfortunately, the above solution is not working, but I think we are getting close. The new url is illustrated below.
Screen Shot 2020-07-20 at 3 22 47 PM

Originally we were lacking the base url /user/chhan part, after the modification, we make the /conda/tasks/{id}?_={some digits} part broken.
is there a way to replace null?_=1595251318851 with conda/tasks/1?_=1595251318851?

Sorry, I wrote the correction too quickly. The following should be better:

-             xhr.getResponseHeader("Location") || url,
+             xhr.getResponseHeader("Location") ? (urls.base_url + xhr.getResponseHeader("Location")) : url,

np :), this time it's working 🎆 , no more warning pop up at the beginning after clicking conda tab. While after clicking the + sign to create a new conda environment, there is a double slash in the URL like thishttp://test.hub.kind.test:8000/user/chhan//conda/tasks/2?_=1595321968764, but this works without any warning.

Thank for helping getting to the bottom of this bug.