Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot list running notebook with --allow-root #2375

Closed
ywchan2005 opened this issue Apr 5, 2017 · 32 comments · Fixed by #2421
Closed

Cannot list running notebook with --allow-root #2375

ywchan2005 opened this issue Apr 5, 2017 · 32 comments · Fixed by #2421

Comments

@ywchan2005
Copy link

ywchan2005 commented Apr 5, 2017

Several command patterns are tried, but none of them succeeds. How may 'root' list the running notebooks?

Case 1
> jupyter --allow-root notebook list
No such file or directory: /root/notebook

Case 2
> jupyter notebook --allow-root list
No such file or directory: /root/list

Case 3
> jupyter notebook list --allow-root
CRITICAL | Unrecognized flag: '--allow-root'

I'm using jupyter notebook 5.0.

@gnestor
Copy link
Contributor

gnestor commented Apr 5, 2017

When I run jupyter notebook list --help-all I get the following:

List currently running notebook servers.

Options
-------

Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.

--json
    Produce machine-readable JSON output.
--config=<Unicode> (JupyterApp.config_file)
    Default: ''
    Full path of a config file.
--log-level=<Enum> (Application.log_level)
    Default: 30
    Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
    Set the log level by value or name.

Class parameters
----------------

Parameters are set from command-line arguments of the form:
`--Class.trait=value`. This line is evaluated in Python, so simple expressions
are allowed, e.g.:: `--C.a='range(3)'` For setting C.a=[0,1,2].

NbserverListApp options
-----------------------
--NbserverListApp.answer_yes=<Bool>
    Default: False
    Answer yes to any prompts.
--NbserverListApp.config_file=<Unicode>
    Default: ''
    Full path of a config file.
--NbserverListApp.config_file_name=<Unicode>
    Default: ''
    Specify a config file to load.
--NbserverListApp.generate_config=<Bool>
    Default: False
    Generate default config file.
--NbserverListApp.json=<Bool>
    Default: False
    If True, each line of output will be a JSON object with the details from the
    server info file.
--NbserverListApp.log_datefmt=<Unicode>
    Default: '%Y-%m-%d %H:%M:%S'
    The date format used by logging formatters for %(asctime)s
--NbserverListApp.log_format=<Unicode>
    Default: '[%(name)s]%(highlevel)s %(message)s'
    The Logging format template
--NbserverListApp.log_level=<Enum>
    Default: 30
    Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
    Set the log level by value or name.

So it appears that the --allow-root flag is not available for the list subcommand, just the jupyter notebook command.

@timvisee
Copy link

timvisee commented Apr 6, 2017

I'm experiencing the same issue, since a few hours. Downgrading a version probably temporarily solves the issue.

@takluyver
Copy link
Member

Are you trying to list notebook servers that are running as root? Does it work without the --allow-root flag?

@timvisee
Copy link

timvisee commented Apr 6, 2017

@takluyver The notebook server is running as root user.

When running the jupyter notebook list command as root user, the command returns it's not recommended to run as root, thus the argument --allow-root can be used to bypass the warning. The problem is however, that the argument --allow-root isn't recognized by the list sub-command. Thus, running jupyter notebook list --allow-root returns a different error. To be exact, the message returned when invoking the command with --allow-root is mentioned by @gnestor 's comment.

Running the notebook as non-root user doesn't seem to make any difference.

As I've mentioned. This problem only started for me since about a day, possibly because of a faulty release.

@gnestor
Copy link
Contributor

gnestor commented Apr 6, 2017

Hmmm, when I run jupyter notebook list I get a list of running servers as expected. @timvisee Are you saying that you can't under any circumstances? Are you running the server locally or on a remote server?

@timvisee
Copy link

timvisee commented Apr 6, 2017

@gnestor Yes, that's right.

I'm running Jupyter Notebook in a custom Docker container in fact. It is installed with miniconda. Thus, running it locally or remotely is irrelevant. I am executing the commands as root (UID 0) however. I'm currently enforcing a previous version to fix the issue.

I'm happy to make a special Docker container image build with the newest Jupyter Notebook version installed if preferred, so you can give it a try :)

@thomasopsomer
Copy link

I'm experimenting the same issue in a similar case:
I spawn jupyter containers with sudo privileges and since the new jupyter image I need to add the --allow-root flag to the singleuser script, but I get the same error 'No such file or directory'

@timvisee if you come up with a trick, I'm interested :)

@gnestor
Copy link
Contributor

gnestor commented Apr 13, 2017

@minrk Do you have any idea what's going on here?

@shantanuo
Copy link

I am having the same problem.
@thomasopsomer If you are trying to list running notebooks just to retrieve password, it is visible when you do docker logs command.

@minrk
Copy link
Member

minrk commented Apr 18, 2017

Should be fixed by #2421

@mikkokotila
Copy link

Regarding being fixed by #2421 I have a related issue and am not sure if that alone fix it. I can create the notebook but can't see the list so can't get the token to access.

I understood the fix is to use the master, but when I do:

pip install git+https://github.com/jupyter/notebook.git

I get the below. i.e it seems that I have an issue with the suggested fix.

  > bower install --allow-root --config.interactive=false
    /usr/bin/env: ‘node’: No such file or directory
    rebuilding js and css failed. The following required files are missing: ['notebook/static/components', 'notebook/static/notebook/js/main.min.js', 'notebook/static/tree/js/main.min.js', 'notebook/static/edit/js/main.min.js', 'notebook/static/terminal/js/main.min.js', 'notebook/static/auth/js/main.min.js', 'notebook/static/style/ipython.min.css', 'notebook/static/style/style.min.css']
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-Hgy2bb-build/setup.py", line 199, in <module>
        main()
      File "/tmp/pip-Hgy2bb-build/setup.py", line 196, in main
        setup(**setup_args)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
        self.run_command('build')
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
        self.run_command(cmd_name)
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "setupbase.py", line 577, in run
        raise e
    subprocess.CalledProcessError: Command '['bower', 'install', '--allow-root', '--config.interactive=false']' returned non-zero exit status 127
    
    ----------------------------------------
  Rolling back uninstall of notebook
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-Hgy2bb-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-a1MnBE-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-Hgy2bb-build/

@takluyver
Copy link
Member

You need node and npm installed to install the notebook from source. See http://jupyter-notebook.readthedocs.io/en/latest/contributing.html#setting-up-a-development-environment

@mikkokotila
Copy link

Thanks, I did install node and also did npm install bower. This might have to do with the fact that I'm inside docker container. Which version would you go back to be safe from the --allow-root bug? Or is there some other way you would suggest I can retrieve the token programmatically? I don't have any other reason to get over this bug than that. Thanks.

@takluyver
Copy link
Member

Is that a Debian/Ubuntu system? If you've installed node from apt, you may need to install the nodejs-legacy package, so that the node command starts NodeJS. Debian packagers called the executable nodejs instead of node, which breaks stuff that assumes it's called node.

Otherwise, I think downgrading to any notebook version <5 should work around this bug until we release 5.1.

@mocanuga
Copy link

mocanuga commented May 4, 2017

Hi,

Have you tried to pass this flag last?
Like so:

jupyter notebook notebook.ipynb --allow-root

It worked for me.

@ghost
Copy link

ghost commented May 15, 2017

Successfully installed npm-0.1.1 optional-django-0.1.0
root@LAPTOP-98SB3UC8:~# jupyter --allow-root notebook list
[C 16:48:45.951 NotebookApp] No such file or directory: /root/notebook

@princejaiswal03
Copy link

I have successfully installed the anaconda on Linux.When i am trying to run jupyter it is showing like follow:
root@prince:~/anaconda2/bin# ./jupyter notebook
[C 14:10:30.328 NotebookApp] Running as root is not recommended. Use --allow-root to bypass.

I also have tried the various command like:
jupyter
start jupyter..
BUT IT does not works at alll..
plse help me in running the Jupyter

@takluyver
Copy link
Member

Like the error message says, it's generally recommended to run the notebook as a 'normal' user, i.e. not root. If you're running it in a docker container or something and don't mind the potential risks of running it as root, add the --allow-root command line flag to let it do that.

@princejaiswal03
Copy link

how i should use --allow-root to overcome this error as root user?

@takluyver
Copy link
Member

As in, you run jupyter notebook --allow-root.

@princejaiswal03
Copy link

Thank ....u....!

@jblakeley
Copy link

Hi all - I'm having a similar issue but having a hard time following this thread. I want to run a similar command:
jupyter notebook password but get the error Running as root is not recommended. Use --allow-root to bypass.

However, this flag does not exist for the password command. I'm also running in a docker container. Running Jupyter v 4.3.0. Any ideas?

@takluyver
Copy link
Member

That one's a bug - --allow-root shouldn't be necessary for setting a password. It's been fixed (#2421), but the fix isn't in a release yet. It should be in notebook 5.1 when we release that soon.

In the meantime, I think you can run Python code to set a password like this:

from notebook.auth.security import set_password
set_password()

@princejaiswal03
Copy link

while installing anaconda on ubuntu i am facing the problem
Warning: md5sum mismatch of tar archieve
expected:b389115abffa441e311f19705c91f15
tar:skipping to next folder
tar:existing with failure status due to previous errors
ERROR:could not extract tar starting at line 589

plse help me in resolving this

@takluyver
Copy link
Member

@princejaiswal03 that looks like an unrelated error. Try asking on https://github.com/ContinuumIO/anaconda-issues/

@UgwakOCrosky
Copy link

Here is the solution, open terminal and run it as root@localhost# and type "jupyter notebook --allow-root" there you go! Give it a try and see the magic happen.

@cipri-tom
Copy link

if you need the token for loggin into a notebook which is run in a docker container, and you no longer have the terminal where it was outputted when you did docker run (or docker start), then you can use the docker logs to recover that token. These capture all terminal output as if you were seeing it live.

Just run docker logs <container-name> | less and search (/) for token=

@IHackPy
Copy link

IHackPy commented Feb 2, 2018

jupyter notebook --allow-root works fine but how I resolve this issue

@Lucidtechie
Copy link

root@Anon:~/Desktop/pycharm-community-2017.3.3/pycharm-community-2017.3.3/jre64/machine learning# jupyter notebook [W 21:12:32.933 NotebookApp] Widgets are unavailable. Please install widgetsnbextension or ipywidgets 4.0 [I 21:12:32.973 NotebookApp] Serving notebooks from local directory: /root/Desktop/pycharm-community-2017.3.3/pycharm-community-2017.3.3/jre64/machine learning [I 21:12:32.973 NotebookApp] 0 active kernels [I 21:12:32.973 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=416d39c53e65035a4be30b03f6ce79b139a8c5d182ff1e98 [I 21:12:32.973 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [I 21:12:33.233 NotebookApp] Accepting one-time-token-authenticated connection from ::1 [I 21:12:40.114 NotebookApp] Writing notebook-signing key to /root/.local/share/jupyter/notebook_secret [W 21:12:40.116 NotebookApp] Notebook Python.ipynb is not trusted [W 21:12:40.199 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20180209211231 (::1) 44.26ms referer=http://localhost:8888/notebooks/Python.ipynb [I 21:12:40.273 NotebookApp] Kernel started: d2fe0058-69de-4a3f-bede-6690a686cc51 [I 21:12:41.424 NotebookApp] Adapting to protocol v5.1 for kernel d2fe0058-69de-4a3f-bede-6690a686cc51 [I 21:14:40.244 NotebookApp] Saving file at /Python.ipynb

@minrk minrk added this to the Reference milestone Sep 13, 2018
@ArnoutDevos
Copy link

I solved the jupyter notebook list error by upgrading the jupyter notebook to the (most) recent version (4.4.0):
pip install --upgrade notebook

@Holmeyoung
Copy link

Hi,

Have you tried to pass this flag last?
Like so:

jupyter notebook notebook.ipynb --allow-root

It worked for me.

Thanks, it worked for me, too.

@chenhao2020
Copy link

Try this, open http://localhost:8888/tree in your browser. good luck!

┌─[✗]─[root@ke]─[~/mywork]
└──╼ #jupyter notebook --allow-root
[I 02:54:02.636 NotebookApp] JupyterLab extension loaded from /root/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 02:54:02.636 NotebookApp] JupyterLab application directory is /root/anaconda3/share/jupyter/lab
[I 02:54:02.638 NotebookApp] Serving notebooks from local directory: /root/mywork
[I 02:54:02.638 NotebookApp] The Jupyter Notebook is running at:
[I 02:54:02.638 NotebookApp] http://localhost:8888/?token=e92356119c9b82a32a52cf3b31eb2fc8978a9db3b24355cd
[I 02:54:02.639 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 02:54:02.678 NotebookApp]

To access the notebook, open this file in a browser:
    file:///run/user/0/jupyter/nbserver-4977-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=e92356119c9b82a32a52cf3b31eb2fc8978a9db3b24355cd

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.