Restrict change in Jupyter Themes - jupyter-notebook

I have a jupyter notebook server up that multiple ppl share.
Someone is changing the theme from default and its impacting everyone. I can't find who and they haven't heeded my pleas to stop.
Is it possible to restrict the use of jupyter themes (jt -t theme-name) without uninstalling jupyter themes (using company distribution so i can't).
I can't uninstall

Related

start jupyter lab in different folder (windows)

For jupyter notebooks, I can do:
jupyter notebook --ExtractOutputPreprocessor.enabled=False --notebook-dir C:/Bla
so I tried something similar for jupyter lab:
jupyter lab --app-dir C:/Bla
but get:
JupyterLab Error
JupyterLab application assets not found in "C:/Bla"
Please run `jupyter lab build` or use a different app directory
I did a few google searches without a clear answer. Could someone please enlighten me? Thanks.
Don't use --app-dir - this is for custom deployments of JupyterLab.
notebook-dir should work fine, as well as ServerApp.root_dir:
jupyter lab --notebook-dir C:/Bla
or
jupyter lab --ServerApp.root_dir C:/Bla
Unless you have a very old version of JupyterLab installed (in that case - upgrade).

Unable to start kernel for jupyter notebooks in a specific directory

No problem in other directories. Is there an environmental variable or something else I need to erase?
Deleted cache file...
OK, I think I need be much clearer here.
First software:
MacOS Catalina 10.15.6
jupyter notebook 6.0.3
Python 3.8.3
IPython 7.16.1
jupyter notebook is installed and runs fine.
jupyter notebook runs just fine in any user directory on the computer except exactly one.
There is nothing obvious in this directory that shouldn't be there. An 'ls -al' shows nothing but some .py files.
I can create a jupyter notebook in this directory, but the kernel crashes and won't restart. I can rename the directory, rename the jupyter notebook, but the behavior persists beyond everything I have been able to reset including a cold computer restart. It is reproducible and happens every time.
This behavior is not seen in any other directory.
My question: are there environmental variables or caches stored not visibly in the directory (obviously) that are responsible for this incredibly annoying behavior and how can I reset them?
Problem solved: jupyter notebooks apparently uses some reserved names for local directory .py files when starting up the notebook. So far I've found that "string.py" and "decorator.py" cannot be in the startup directory unless they contain the expected data (looks like it needs to be related to some template info)
To start-up a kernel
You first activate your virtual environment:
For instance: conda activate vision
Second, you type jupyter notebook
as stated here

How to change Users folders in jupyter notebook and jupyterlab?

I have a question about jupyter notebook and jupyter lab and anaconda?
Does someone knows how to change the users folder from User a to b as an example?
I mean like I have 2 users in my PC and I want to use my secondary users folder in jupyter notebook and jupyterlab instead of my primary user folder.
Thank you
Create custom launching scripts for each user. The working directory can be set for jupyter lab using command line parameters:
jupyterlab --NotebookApp.notebook_dir=<directory_name>
(or using Jupyter config).
See related answer for the post: (How to change the Jupyter start-up folder)[https://stackoverflow.com/a/45515095/3247880]

How to find jupyter <nbextension require path> for Table of Contents (2) extension?

I'd like to install and enable Table of Contents (2) plugin using command-line.
The docs suggest that I can do the following
jupyter nbextension enable <nbextension require path>
How do I find this path for this extension?
Easy solution:
1/ Visit this unofficial list of nbextensions:
https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions.html
and pick the extension you want to enable. Say e.g. that I want to enable "Collapsible Headings", then
2/ type:
jupyter nbextension enable collapsible_headings/main
If the extension is enabled you will see an OK message.
So in general type:
jupyter nbextension enable <name_of_extension>/main
Most of the times it will work for you.
Based on #jfbercher's comemnt in jupyter_contrib_nbextensions#947:
jupyter nbextension install <url>/toc2.zip --user
jupyter nbextension enable toc2/main
If a non-default directory is used in nbextensions_configurator, it can be obtained like the code here:
nbextension_dirs = nbapp_webapp.settings['nbextensions_path']
Yeah this does seem like a bit of an oversight. I tried to install the configurator... but had issues.
The approach that worked for me was to look in ~/.local/share/jupyter/nbextensions or similar (you might need to use a docker run image /bin/bash if you are drinking too much koolaid - or your employer is forcing you to. ).
There is then a .js file in various directories which I think correspond to the extension names. E.g. hinterland/hinterland.js means the extension is called hinterland/hinterland.

Open multiple jupyter notebook with different extension config

I share a linux server user with my teammate, and we used the same jupyter notebook server together.
However recently I found some interesting plugins, so I created a new jupyter notebook directory ~/.my_jupyter, which is a copy of origin ~/.jupyter, and open jupyter notebook with config=/path/to/.my_jupyter/my_config.json then install some plugin by jupyter_contrib_nbextensions.
But when I enable a plugin in my jupyter, the other jupyter enable that plugin too. I found that new jupyter still reference the plugin status by origin .jupyter/nbconfig.
I am looking for a way to change nbconfig path just in my jupyter, hope someone can help me figure it out.
Thanks
Finally figure it out.
Create new tmux session and do following line in terminal:
export JUPYTER_CONFIG_DIR=/path/to/.my_jupyter
which .my_jupyter is configure path of your jupyter like origin ~/.jupyer.

Resources