I'm trying to use the bash kernel in iPython/Jupyter notebook, but I need sudo access within the notebook itself.
I've tried $ sudo jupyter notebook
to run the notebook as root, but that only returns:
$ jupyter: 'notebook' is not a Jupyter command
So, I'm left with running $ jupyter notebook
(unless there's a way to run Jupyter notebook as root).
I also can't do su root
in the notebook itself because that requires an input and the notebook won't let me give an input.
Finally, there is allegedly an --allow-root
option for Jupyter notebook:
http://jupyter-notebook.readthedocs.io/en/latest/config.html
However, it looks like --allow_root
is no longer an option. (I've tried modifying the config file by adding NotebookApp.allow_root=True
, but that doesn't work.)
Any ideas guys? Maybe I'm doing something wrong?
Just login as root, then do the following command to start the notebook :
jupyter notebook --allow-root
The solution as described here. Is to use
sudo -E env "PATH=$PATH" jupyter notebook
Basically the binary to call jupyter notebook
is in the user's PATH
variable, but not for root.
Best regards.
Add c.NotebookApp.allow_root=True
from the root configuration files. That you don't need ask to allow-root
every time then you start the notebook.
Edit:
Before edit the configuration file you need to run jupyter notebook --generate-config
as root to make the file.
I am running the neopixel library from a jupyter notebook.
The only thing that worked for me was first running the "sudo su" command to move into the root environment and then run "jupyter notebook" (--allow-root alone didn't work for me).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With