VPython on Windows System For Linux (WSL 2)

102 views
Skip to first unread message

John

unread,
Sep 8, 2022, 4:13:21 PM9/8/22
to VPython-users
Here are some instruction for setting up and running vpython in a Jupyter Notebook on a Windows System for Linux (WSL 2) on a Windows 10 machine. So this will be like having VPython running on a Linux machine and connecting to it from a browser from you Windows 10 machine.

Step 1)  Install Windows System for Linux on your Windows 10 machine. See the following short video for instruction on how to do that.


Step 2) Install Anaconda on Ubuntu Linux from terminal


Step 3)  Install JupyterLab and VPython from Ubuntu terminal
 
   conda install -c conda-forge jupyterlab
   conda install -c conda-forge vpython
   conda install -c conda-forge jupyterlab-vpython

Step 4)  Launch jupyterlab in no-browser mode

    jupyter lab --no-browser

Step 5)  Copy the link provided, something like 


and paste it into a browser on your Windows 10 machine. Replace the portion of the address 


with 


to get somethin like


Step 6) You should see the JupyterLab user interface appear in your browser. So you end up with the JupyterLab kernel running on the Linux Ubuntu virtual machine and you are connected to it from a browser running on your Windows 10 operating system.

John

John

unread,
Sep 9, 2022, 1:52:47 PM9/9/22
to VPython-users
When you launch jupyterlab in --no-browser mode from Windows System for Linux (WSL 2) terminal on a Windows 10 machine with the command

    jupyter lab --no-browser

you will then get instructions like the following on how to connect to it from a browser.

    To access the server, open this file in a browser:
        file:///home/username/.local/share/jupyter/runtime/jpserver-570-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=9c19bb29ead276228807277dcdaea4767a700df6a485b0c8
     or http://127.0.0.1:8888/lab?token=9c19bb29ead276228807277dcdaea4767a700df6a485b0c8

 You can just enter the latter two options in your browser on Windows 10 to connect to jupyterlab  kernel running on the Ubuntu Linux virtual machine in WSL. For instance just enter option two or three above from your system e.g. 


in the browser address bar and you should get the jupyerlab interface.

For option 1 above 

 file:///home/username/.local/share/jupyter/runtime/jpserver-570-open.html

you will need to change it to 

 file://wsl$/Ubuntu-20.04/home/username/.local/share/jupyter/runtime/jpserver-570-open.html

For it to connect to jupyterlab running on WSL 2 .

John
Reply all
Reply to author
Forward
0 new messages