PyCharm 2017.2 Help

Configuring Remote Interpreters via WSL

This feature is supported in the Professional edition only.


PyCharm can be configured to use WSL as remote interpreter, but without deployment, since each drive on Windows is mapped to the appropriate folder in /mnt/<DRIVE_NAME> in WSL. So, only mappings need to be configured.

Use as the host name, and login and password entered after first lxrun /install. Also, set C:\ to /mnt/c/ in the mappings.


Make sure that the following prerequisites are met:

  • Win10 build 14361 or later is installed. It is also possible to upgrade the current Insider Preview.
  • WSL is installed (like lxrun /install or lxrun /update)

Running SSH on WSL

  1. Run bash.exe.
  2. Update to latest version sudo apt-get update or sudo apt-get upgrade.
  3. Open /etc/ssh/sshd_config file for editing:
    • Enable password authentication (unless you want to use the public keys): set PasswordAuthentication to yes.
    • Since chroot is not implemented in WSL, you also need to set UsePrivilegeSeparation to no.

    Save changes and close sshd_config.

  4. Type sudo $(sudo which sshd) -d to run OpenSSH in the foreground. You should see something like "Server listening on <server> port <number>"
  5. From another bash.exe session, try ssh
  6. If you see a message about ECDSA encryption algorithm fingerprint, answer y. Password prompt appears, which means that the server works correctly.
  7. Turn it off with Ctrl+C, and type the command sudo service ssh start to start the server in daemon mode. Looks like upstart is broken in the current WSL, so you would need to run bash.exe, start sshd and keep console window opened, since WSL stops when the last client disconnects. You may create wsl_ssh.bat file like bash.exe -c "sudo service ssh start &&& sleep 999d" and use it to launch ssh.

Now that SSH is running, you can configure the remote interpreter.

Configuring WSL as remote interpreter

To configure WSL as the remote interpreter, follow these steps

  1. In the Project Interpreter page of the Settings/Preferences dialog box, click /help/img/idea/2017.2/cogwheel_framed.png.
  2. From the drop-down list, choose Add Remote.

    The dialog box Configure Remote Python Interpreter opens.

  3. In the dialog box Configure Remote Python Interpreter, click the radio-button SSH credentials:
  4. In the Configure Remote Python Interpreter dialog box, fill in the server information (host=localhost or, port = 22, user name and password used on first launch of lxrun /install.)
  5. The Python interpreter path field displays the path to the desired Python executable. You can accept default, or specify a different one.
  6. Click OK in the Configure Remote Python Interpreter dialog box. The configured remote interpreter is added to the list.

Later, you can use this interpreter as the project interpreter. The only difference lays with path mappings.

To configure path mappings, follow these steps

  1. Next to the Path mappings field, click /help/img/idea/2017.2/browseButton.png. Edit Project Path Mappings Dialog opens.
  2. In this dialog box, map local paths to remote ones (for example, map C:\ to /mnt/c/):

    Several mappings are delimited with semicolons.

  3. Click OK when ready.
Last modified: 26 October 2017

See Also

Language and Framework-Specific Guidelines: