Hi there,
I am trying to use a JupyterLab server extension inside JupyterHub. I already checked other threads and I actually just replied to one of them where OP had a very similar issue.
Everything works fine in JupyterLab, and when I deploy the container in the JupyterHub server, I can see that the frontend extensions that I developed work completely fine. But when I try to deploy the server extension, it doesn’t seem to work
To give some context, I am using Zero to JupyterHub with a custom Docker image to install the extensions in the container. Then, inside singleuser in my config.yaml
file , I have:
singleuser:
image:
name: <repo>/<image>
tag: <my_tag>
The Dockerfile looks like this:
FROM jupyterhub/singleuser:latest
USER root
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git && \
pip install nbgitpuller
COPY . .
RUN jupyter server extension enable nbgitpuller --sys-prefix && \
pip install -e . && \
jupyter server extension enable <my_extension> --sys-prefix
I deploy the jupyterhub server, and everything works fine, until I check the logs, and see that it can’t find the endpoint. When I check the logs for a user that has just spawned a server, one of the first messages I get is:
<my_extension> | error adding extension (enabled: True): The module '<my_extension>' could not be found (No module named 'my_extension>'). Are you sure the extension is installed?
If I go to that pod, I can see that the jupyter labextension list
shows <my_extension>, but when checking jupyter server extension list
, I get the same issue:
jupyter server extension list
Config dir: /home/jovyan/.jupyter
Config dir: /opt/conda/etc/jupyter
<my_extension> enabled
- Validating <my_extension>...
X The module '<my_extension>' could not be found (No module named '<my_extension>'). Are you sure the extension is installed?
jupyter_lsp enabled
- Validating jupyter_lsp...
jupyter_lsp 2.2.5 OK
...
One thing I noticed is that the files that should be added for backward compatibily are not there even though I added them when I created the extension. This is the setup.py
file:
from setuptools import setup
setup(
name="<my_extension>",
version="0.1.0",
packages=["<my_extension>"],
install_requires=[
"jupyter_server",
"tornado"
],
include_package_data=True,
data_files=[
("etc/jupyter/jupyter_server_config.d", ["jupyter-config/server-config/<my_extension>.json"]),
("etc/jupyter/jupyter_notebook_config.d", ["jupyter-config/nb-config/<my_extension>.json"])
]
)
Can someone point me what I am doing wrong please?
Thanks!