57

I installed wsl(Windows Subsystem for Linux) with ubuntu and jupyter notebook on it. When I run my jupyternote book, I get this error message. Could you give me some advice? Many thanks in advance!


Start : This command cannot be run due to the error: The system cannot find the file specified. At line:1 char:1

  • Start "file:///home/purit/.local/share/jupyter/runtime/nbserver-26-op ...
  •   + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
      + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    
Cheolsoon Im
  • 716
  • 1
  • 6
  • 11
  • Start : This command cannot be run due to the error: The system cannot find the file specified. At line:1 char:1 + Start "file:///home/purit/.local/share/jupyter/runtime/nbserver-26-op ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand – Cheolsoon Im Jul 09 '20 at 11:40
  • 1
    When using `start`, you can't use the `file:///` protocol. You need the actual path to the file only. `file:///` is only for use in a web browser's address bar. `start` is also a Windows command. – Ken White Jul 09 '20 at 12:14
  • Thanks so much. Then, could you kindly tell me how I should fix it? – Cheolsoon Im Jul 09 '20 at 12:33
  • Also, if you move your comment into the answer, I will accept it. :) – Cheolsoon Im Jul 09 '20 at 12:35
  • 1
    I followed this tutorial when I install "jupyter notebook." on Ubuntu. https://www.digitalocean.com/community/tutorials/how-to-set-up-jupyter-notebook-with-python-3-on-ubuntu-18-04 – Cheolsoon Im Jul 10 '20 at 00:58
  • This also occurs with `jupyter lab` and the answer from @Maiteya Verma (specifying --no-browser) also works for this. – Dave Jun 20 '22 at 08:09

5 Answers5

51

This one worked for me.

jupyter notebook --port=8889 --no-browser

You can also checkout this thread if any other solutions work out for you.

Maitreya Verma
  • 631
  • 4
  • 4
38

Here's a nice walkthrough that explains how to set up jupyter notebook to run with WSL and launch your browser in Windows without this error:

https://towardsdatascience.com/running-jupyter-notebook-on-wsl-while-using-firefox-on-windows-5a47ebfae4c1?gi=fc70b24c75bf

There are two important steps:

  1. Run jupyter notebook --generate-config to generate the file ~/.jupyter/jupyter_notebook_config.py then change the following line:

c.NotebookApp.use_redirect_file = False

  1. Add your browser to ~/.bashrc E.g.

export BROWSER='/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'

Don't forget to source bashrc:

source ~/.bashrc

That should fix the error without having to run jupyter notebook --no-browser.

Marek Příhoda
  • 11,108
  • 3
  • 39
  • 53
j_d_b
  • 638
  • 5
  • 11
9

Apparently the problem occurs because the Jupyter notebook tries to open the browser after it is started. To disable this, follow these steps:

$ jupyter notebook --generate-config
$ cd /home/YourUser/.jupyter/
$ nano jupyter_notebook_config.py

Now you need scroll down and find "NotebookApp.open_browserBool", remove the # and set it to False. Save your config file and start jupyter notebook again.

3

This is interesting. I actually get the same error. I am currently using ubuntu 20.04 but never had a problem with an older version. My question is, does the jupyter notebook you're setting up still work? Because for me, the links it gives actually do still work and I can run everything perfectly. So it might be worth it to just try the links.

Schalky
  • 35
  • 1
2

I have done following steps,

  1. Run jupyter notebook --generate-config
  2. Run sudo nano /home/{username}/.jupyter/jupyter_notebook_config.py
  3. Removed # from => c.NotebookApp.use_redirect_file = True (I changed True to False)
  4. And also i added windows path as default notebook_dir c.NotebookApp.notebook_dir = '/mnt/d/Jupyter/'
Rinshan Kolayil
  • 1,111
  • 1
  • 9
  • 14