Using Jupyter with Windows Subsystem for Linux

前端 未结 4 1134
情深已故
情深已故 2021-02-13 20:56

Using the Ubuntu bash terminal on Windows 10 (installation instructions here), I installed Anaconda and have been using Jupyter notebooks without a problem. Unfortunately, Jupyt

4条回答
  •  走了就别回头了
    2021-02-13 21:19

    I had similar issue with browser, I got

    No web browser found: could not locate runnable browser.
    

    I installed WSLU https://github.com/wslutilities/wslu. Then I got

    Start : This command cannot be run due to the error: The system cannot find the file specified.
    At line:1 char:1
    + Start --h
    + ~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    

    jupyter-notebook does not supply url as a parameter to wlsview. It passes a path with file to browser. eg

    file:///home/myhome/.local/share/jupyter/runtime/nbserver-5058-open.html
    

    with actual url

    
    
    
        
        
        Opening Jupyter Notebook
    
    
    
    

    This page should redirect you to Jupyter Notebook. If it doesn't, click here to go to Jupyter.

    Create a file jupyter-notebook-browser with a content to extract actual url

    #!/bin/bash
    file=$(echo "$1" | sed 's/file:\/\///')
    url=$(grep -oP 'href="\K([^"]*localhost[^"]+)' "$file")
    wslview "$url"
    

    then run jupyter-notebook --browser=jupyter-notebook-browser

    or define BROWSER variable and run

    export BROWSER="jupyter-notebook-browser"
    jupyter-notebook
    

提交回复
热议问题