How to change Users folders in jupyter notebook and jupyterlab? - jupyter-notebook

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]

Related

copy jupyter lab notebooks from github

We have jupyter lab installed on kubernetes and notebooks uploaded to github. I want to copy these notebooks to another instance of jupyter lab. So, I logged into the pod and ran git clone command. notebooks were copied and they are visible in UI too. But other users are unable to see these files as we have user specific pods. Can someone please suggest how to make these notebooks available to other users in read only mode.

JupyterLab not loading environment variables

I have some passwords and such set in my bash_profile that I want to be able to access from within Jupyter notebooks. They are successfully loaded whenever I use just a Jupyter notebook, but not when I use JupyterLab.
I am using Anaconda, and I double checked that the location of my JupyterLab and JupyterNotebook's are the same using which jupyter/jupyter-lab/jupyter-notebook and they do all point to my Anaconda bin directory. I also made sure the anaconda3/bin directory is in my bash profile and that the conda environment was activated.
Whenever I run os.environ in a notebook using Lab versus just a plain notebook I expect the same output, however the Lab instance does not load anything I have manually added to my profile while a plain notebook does.

Audit Commands run in Jupyter Notebook

Requirement:
Be able to audit (using logs) all the commands run in Jupyter Notebook by a user. The Jupyter Notebook is installed on Dataproc.
Is there a way we can log the command run by the user at the same time.
I have already tried changing Application.log_level in jupyter config file to 0 but no luck.
Looks like there was some discussion about this FR in the Jupyter community: https://groups.google.com/forum/#!topic/jupyter/sLKCCBwlKEc. You would have to modify the Jupyter kernel to print out all commands to a file.

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.

How do I set the save location of a session in Jupyter notebook?

I'm working with Jupyter Notebook version 4.1.0 and can't seem to manually select the save path.
How does one manually specify where a session is saved?
You can launch jupyter notebook from the command line from inside the desired folder path. This will set the current folder as the start of the directory tree in Jupyter.
If we already have a session running, we can select the option IPython Notebook (.ipynb), from the file menu, under the Download as option. After saving the Notebook to a desired path, we can open it using the method described above.

Resources