Disable Downloads not working

I’m creating a course where each student is given a virtual machine in a Kubernetes cluster with a Docker image based on the Jupyter Notebook Deep Learning Stack. The students work in a Jupyter Lab environment, and I would like to disable downloads.

I’ve read through Yuvi Pandas post on this, this whole thread on GitHub, and lots of StackOverflow posts. Based on this, I created this page_config.json file:

{
   "disabledExtensions": {
         "@jupyterlab/docmanager:download": true,
         "@jupyterlab/filebrowser:download": true
   }
}

I copied this file to the to the /opt/conda/etc/jupyter/labconfig/ directory on the image, but the downloading still works. I’ve tried disabling it manually:

jupyter labextension disable @jupyterlab/docmanager-extension:download
jupyter labextension disable @jupyterlab/filebrowser-extension:download

Still no luck.

I can disable other things in page_config.json, like the terminal. And I’ve been able to disable other downloads by adding an overrides.json to /opt/conda/share/jupyter/lab/settings/. So I’m not sure why this isn’t working. Is there something I’m missing here?

Many thanks, all! :grinning:

Link to the Jupyter Notebook Deep Learning Stack.

Some things to check first:

  • is the path that you copied it into in jupyter --path
  • what is your jupyter labextension list
  • what is your JupyterLab version when you run jupyter --version?
  • what is your JupyterLab version in the HelpAbout after booting?
  • is there a build step in the image? Is there any failure in the logs?

Thanks for the help, @krassowski!

Yup!

config:
    /home/jovyan/.jupyter
    /opt/conda/etc/jupyter # <-- Here
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/jovyan/.local/share/jupyter
    /opt/conda/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/jovyan/.local/share/jupyter/runtime
JupyterLab v3.1.12
/opt/conda/share/jupyter/labextensions
        jupyter-matplotlib v0.10.0 enabled OK
        nbdime-jupyterlab v2.1.0 enabled OK
        jupyterlab-plotly v5.3.1 enabled OK
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/git v0.33.0 enabled OK (python, jupyterlab-git)
        @aquirdturtle/collapsible_headings v3.1.0 enabled  X (python, aquirdturtle_collapsible_headings)
        @ijmbarr/jupyterlab_spellchecker v0.7.2 enabled OK (python, jupyterlab-spellchecker)
Selected Jupyter core packages...
IPython          : 7.27.0
ipykernel        : 6.4.1
ipywidgets       : 7.6.5
jupyter_client   : 7.0.3
jupyter_core     : 4.8.1
jupyter_server   : 1.11.0
jupyterlab       : 3.1.12
nbclient         : 0.5.4
nbconvert        : 6.1.0
nbformat         : 5.1.3
notebook         : 6.4.4
qtconsole        : not installed
traitlets        : 5.1.0

3.1.12

Like a jupyter lab build step? No, and that might be the problem. Where in the Dockerfile would I put that? At the very end? Does that matter if I’m using the page_config.json file?

I don’t think the build step should be necessary, but sometimes people have it in their Dockerfile and it leads to a failure and some weird things happen, always worth checking.

So after disabling the extension you should see it in jupyter labextension list. It does not seem to be there in your case indeed. For me it looks like this:

$ jupyter labextension list
JupyterLab v3.2.0rc0
/some/path/.local/share/jupyter/labextensions
        nbdime-jupyterlab v2.1.0 enabled OK

/some/path/jupyter/labextensions
        spreadsheet-editor v0.6.1 enabled OK (python, jupyterlab-spreadsheet-editor)
        jupyterlab-citation-manager v0.1.2 enabled OK (python, jupyterlab-citation-manager)
        ...

Other labextensions (built into JupyterLab)
   app dir: /some/path


Disabled extensions:
    @jupyterlab/docmanager-extension:download

Have you tired putting jupyter labextension disable @jupyterlab/docmanager-extension:download into the Dockerfile?

2 Likes

That did the trick! I added this to the Dockerfile.

RUN jupyter labextension disable @jupyterlab/docmanager-extension:download \
    && jupyter labextension disable @jupyterlab/filebrowser-extension:download

Voilà! Really appreciate your help. :grinning_face_with_smiling_eyes:

2 Likes

I have made below mentioned changes . File browser download and right click down load is not disabled . Any suggestions please

  1. /opt/conda/etc/jupyter/labconfig$ cat page_config.json
    {
    “disabledExtensions”: {
    @jupyterlab/docmanager-extension:download”: true,
    @jupyterlab/filebrowser-extension:download”: true
    }

  2. Also in Docker file
    RUN jupyter labextension disable @jupyterlab/docmanager-extension:download
    && jupyter labextension disable @jupyterlab/filebrowser-extension:download

Also i have checked via notebook terminal it is saying lab extension disabled but not working

base) jovyan@rntest-0:/opt/conda/etc/jupyter/labconfig$ jupyter labextension list
JupyterLab v3.0.16
/opt/conda/share/jupyter/labextensions
        jupyter-matplotlib v0.9.0 enabled OK
        nbdime-jupyterlab v2.1.0 enabled OK
        jupyterlab-plotly v5.3.1 enabled OK
        @jupyterlab/git v0.30.1 enabled OK (python, jupyterlab-git)
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: /opt/conda/share/jupyter/lab


Disabled extensions:
    @jupyterlab/docmanager-extension:download
    @jupyterlab/filebrowser-extension:download
(base) jovyan@rntest-0:/opt/conda/etc/jupyter/labconfig$ 

Above issue occurred due to jupyter --version . I have update the jupyter version in docker file to RUN pip install jupyterlab==3.1.0a5

And RUN below command in docker file too

RUN jupyter labextension disable @jupyterlab/docmanager-extension:download
&& jupyter labextension disable @jupyterlab/filebrowser-extension:download as stated by ncgoodbody in above discussion . This changes disable the dowload functionality and right click download