Using Wing Pro with Windows Subsystem for Linux

Index of All Documentation » How-Tos » How-Tos for Specific Environments »


Wing Pro Screenshot

Wing Pro is a Python IDE that can be used to develop, test, and debug Python code running on Windows Subsystem for Linux (WSL), including both WSL 1 and WSL 2.

This document describes how to configure Wing Pro for WSL. To get started using Wing Pro as your Python IDE, please refer to the tutorial in Wing's Help menu or read the Quickstart Guide.

Prerequisites

To use Wing Pro with WSL you will need to install Python on WSL and be able to SSH from Windows into WSL. If you don't already have this working, see Setting up WSL below before trying to create a project in Wing Pro.

If you do not already have Wing Pro installed, download it now.

Creating a Project

To create a Wing Pro project that accesses Linux under WSL:

  • Use New Project from the Project menu and then select Create New Configuration from the Host menu in the New Project dialog.
  • Leave the Remote Host Type in the New Remote Host dialog set to Generic.
  • Set Identifier to wsl or some other short name for the WSL-hosted Linux.
  • Set Host Name to username@ipaddress where username is replaced with the user name running on Linux and ipaddress is replaced with the IP address that ip a reports inside your WSL system. The user name is needed even if it is the same as the user running on Windows.
  • Set Python Executable to Command Line and enter /usr/bin/python3 or the full path to the Python executable you wish to use on Linux.
  • If you are running the SSH server on Linux under a non-standard port, set SSH Port under the Options tab.
  • If you are using an older WSL version that allows connecting with username@127.0.0.1 then you will also need to set Manage SSH Tunnels under the Advanced tab of the remote host configuration to Never Create Tunnel. This should not be done if using an IP address other than 127.0.0.1 in the Host Name field.
  • Leave the rest of the configuration values set to their defaults and press OK.

Wing Pro should install the remote agent and confirm that it is working. Then you can continue through the New Project dialog to select or create your source directory and select or create the Python environment to use. See Creating a Project for details.

You will be able to edit, debug, test, search, and manage files on the WSL-hosted Linux installation, or launch commands running on Linux from Wing Pro's OS Commands tool.

To learn more about Wing Pro's remote development capabilities, see Remote Hosts.

To learn more about Wing Pro's features, take a look at the Tutorial in Wing's Help menu or the Quickstart Guide.

Setting up WSL

Here is one way to set up WSL with Ubuntu as the Linux distribution and PuTTY as the SSH client:

Enable WSL and Install Ubuntu Linux:

  • Enable WSL in Windows 10+. This is done in the Settings app under Apps > Apps & features > Related settings / Programs and features > Turn Windows features on and off. Restart when prompted.
  • Install Ubuntu from the Microsoft Store.
  • Install Python in Ubuntu with sudo apt-get install python3 if not already present.

Fix the SSH server on Ubuntu:

  • Some versions of Ubuntu under WSL seem to be initially misconfigured so that connecting to the SSH server immediately drops the connection. If you run into this, you can fix the problem with sudo apt-get purge openssh-server followed by sudo apt-get install openssh-server and then sudo service ssh --full-restart. Type wsl on Windows to get into your WSL system without needing the SSH server to work.

Each time you restart Windows or Ubuntu:

  • Run sudo service ssh --full-restart on Ubuntu to make sure the SSH server is started.

Find the IP Address for Ubuntu

  • Run wsl on Windows
  • In the resulting WSL prompt, run ip a to get the IP address for eth0. For example, in the following output fragment the IP address is 172.17.134.127 (the number right after inet in the eth0 section):

    4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
      link/ether 00:15:5d:a8:d9:33 brd ff:ff:ff:ff:ff:ff
      inet 172.17.134.127/20 brd 172.17.143.255 scope global eth0
         valid_lft forever preferred_lft forever
    

Now you should be able to connect to Ubuntu using username@ipaddress, with username replaced with your Ubuntu-side user name and ipaddress replaced by the IP address you just found. You can try this with PuTTY's plink.exe or OpenSSH's ssh.exe if you have those, or proceed to creating your Wing project (see above) to use Wing's built-in SSH implementation.

Notes

In the unlikely event that you already have an SSH server running somewhere on your system on port 22, you will need to change the port number used on Ubuntu in /etc/ssh/sshd_config and then execute sudo service ssh --full-restart again. In this case, you also need to set the port in your remote host configuration in Wing, under the Options tab.

Other Linux distributions are also available in the Microsoft Store.

It is also possible to use Open SSH instead of PuTTY. See Working with OpenSSH for details.

Related Documents

For more information see: