How to restart the server in jupyter hub through command line? - jupyter-notebook

I have an instance of Jupyter running in Jupyter hub where there was an option to start/restart server as shown below:
I then changed the theme using the command
jt -t <theme name>
Now, I can't see the option to stop and restart my server in my home screen
Somebody please help me where I can find this option?
I typed the below command in Jupyter terminal and it doesn't work.
jupyter notebook stop 8888

This is now under the JupyterHub/Lab File menu at the bottom, "Hub Control Panel".
Selecting that option for me brings up the new version of the menu depicted in your image at the following URL:
http://127.0.0.1:8000/hub/home
HTH

Related

Jupyter notebook seems to remember previous path (!pwd) after being moved to a different directory?

I initially had a notebook in one directory in AWS SageMaker JupyterLab, say /A, but then moved it into /A/B. However, when I run !pwd in a jupyter notebook cell, I still get /A. This happens even when I press 'restart kernel'. How does the notebook remember this, and is there a way to prevent or reset this?
Thanks
I was actually using AWS SageMaker, and restarting the kernel from the toolbar was not enough. I needed to restart the kernel session, by pressing 'shut down' in the "Running terminals and kernels" section on the left navigation.
They are currently discussing warning users about the need to restart the kernel when a notebook is moved.

Issue running jupyter notebook via wls

Installed WSL on Windows 10.
Installed Anaconda according to the Anaconda documentation with the following commands:
bash Anaconda3-2020.02-Linux-x86_64.sh
source ~/.bashrc
You can see the '(base)' in the beginning of each command input line, indicating the conda is activated.
Then I run jupyter notebook by typing:
jupyter notebook
Then I see the following changes as shown in the screen record.
Briefly, the WSL terminal window showed some information very quickly, but is changed to the windows powershell window before you could even tell the information that showed up. I know those information should contain a file and url for opening the jupyter notebook in the web browser. But they flashed out so quickly. Does anyone know why this happens?
Here is a dynamic graph of the Screen record of this issue:
Solved:
1. Wait for a bit more time on the windows cmd and the jupyter notebook running information will show up, where includes the url to open jupyter notebook in the web browser.
OR
Open up another wsl terminal, activate the same environment and type jupyter notebook list, which will show the current running jupyter notebook server. The url is also can be found there.

"Unable to connect to the local runtime" in google colab

I'm trying to connect local run time but it's not connecting,
I used the troubleshooting dialog following commands:
pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws
jupyter notebook \ --NotebookApp.allow_origin='https://colab.research.google.com --port=8888 \--NotebookApp.port_retries=0
Have tried the same above steps as said in below URL
https://research.google.com/colaboratory/local-runtimes.html
Facing an issue 'Jupyter authentication cookie was not detected'
Tried by disabling adblocker, antivirus and also using different port numbers. Below was the solution given by team
Navigate to http://localhost:8888 in a separate browser tab and follow the provided instructions. This will set a browser cookie used for authentication between the browser and the Jupyter notebook server.
But when I open the URL, it asks for a password(already set up) and then no further instructions are appearing.
This issue was raised in Github issues for Collaboratory:
This answer helped me https://github.com/googlecolab/jupyter_http_over_ws/issues/1#issuecomment-557469128
According to this issue
start the jupyter notebook with the below command.
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --NotebookApp.port_retries=0 --notebook-dir="" --no-browser --allow-root --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True --port=8888
then open the notebook by going to this URL.
localhost:8888
according to kris This may allow you to connect, but it basically disables all security features.
Then retry connecting to local runtime with Google Colab
If it does not solve your problem then try disabling AdBlock extension or app.
For Windows (10/11)
Method 1: Using git bash
follow these steps
https://research.google.com/colaboratory/local-runtimes.html
Method 2: Using Windows terminal & Multiline commands
Install jupyter_http_over_ws
pip install jupyter_http_over_ws
enable the jupyter_http_over_ws jupyter extension (one-time)
jupyter serverextension enable --py jupyter_http_over_ws
Use multiline commands to start server and authenticate
jupyter notebook ^
--NotebookApp.allow_origin='https://colab.research.google.com' ^
--port=8888 ^
--NotebookApp.port_retries=0
Method 3: Using single-line command & windows terminal
Install jupyter_http_over_ws
pip install jupyter_http_over_ws
enable the jupyter_http_over_ws jupyter extension (one-time)
jupyter serverextension enable --py jupyter_http_over_ws
Use single-line commands to start server and authenticate
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
Once the server has started, it will print a message with the initial backend URL used for authentication. Make a copy of this URL as you'll need to provide this in the next step.
Connect to the local runtime
In Colaboratory, click the "Connect" button and select "Connect to local runtime...". Enter the URL from the previous step in the dialog that appears and click the "Connect" button. After this, you should now be connected to your local runtime.
There are several reasons why a local connection might fail. To gather more diagnosis information, click the 'troubleshoot' link in the notification that appears in the lower left of the screen.
It will look like this:
I'd recommend following whatever steps are recommended there. If you get stuck, please update your original question with the diagnosis offered in the troubleshooting dialog.

Creating Folder Failed on jupyter notebook

When I click "New" to create text file,folder, and python3 file on jupyter notebook, it shows that "Creating File Failed" and "An error occurred while creating a new file". Could you please give me some advice about how to solve this problem ? The screenshot is attached. Thank you very much !
Some details: I use pip install jupyter to install jupyter notebook in Linux environment. You can see from the attached screenshot that there is a new icon near to the upload icon on the upper right, then I click the black upside-down triangle on the new icon, then I choose folder. This is the process in which I try to create a new folder on jupyter notebook.
Use the --user tag with pip
The reason you cannot create a folder is because you do not have permission. This could be that you are not a on the sudo list or that you are not the owner of the folder where you are trying to create a new folder.
You can potentially avoid these problems by removing your jupyter install and re-installing with the '--user' option. Be sure that you have configured a non root user with sudo privileges and that you are logged in as that user. Try the following:
pip uninstall jupyter
pip install jupyter --user
Run notebook as usual:
jupyter notebook
One more thing, be sure that you are trying to create a folder in your home directory. If you are user "Bob", make sure you are creating the folder in /home/bob/ You are the owner of this directory and should be able to modify it as you wish.
Further reading:
link1
link2
I have found reasons that I cannot create new folder/file on jupyter notebook. Reason is that I directly open jupyter notebook in the anaconda3 environment, that's incorrect! Intuitive description is that I should switch from /home/${USER}/anaconda3 to /home/${USER}/anaconda3/bin, because when I use whereis jupyter, I find that jupyter is under /~/bin directory. So, I have a try and succeed !

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