PyCharm 2019.2 Help

Configure a remote interpreter using SSH


  • A ssh server should run on a remote host, since PyCharm runs remote interpreter via ssh-session.

  • If you want to copy your sources to a remote computer, create a deployment configuration, as described in the section Creating a Remote Server Configuration.

Configuring remote Python interpreter via SSH credentials

Configure a remote Python interpreter via SSH credentials

  1. Ensure that you have downloaded and installed Python on your computer.

  2. Open the Add Python Interpreter dialog by either way:

    • When you're in the Editor, the most convenient way is to use the Python Interpreter widget in the status bar. Click the widget and select Add Interpreter ...

    • Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PyCharm | Preferences for macOS.

      In the Settings/Preferences dialog Ctrl+Alt+S, select Project <project name> | Project Interpreter. Click the The Configure project interpreter icon and select Add.

  3. In the left-hand pane of the Add Python Interpreter dialog, click SSH Interpreter.

  4. In the right-hand pane select New server configuration, then specify server information (host, port, and username).

    adding an interpreter via SSH
    Alternatively, you can select Existing server configuration and choose any available deployment configuration from the list.
    Existing SSH configuration
    If needed, click the Browse button to review the Connection settings, Mappings, and Excluded paths for the selected deployment configuration. Click Next to continue configuring an interpreter.

  5. In the next dialog window, provide the authentication details to connect to the target server.

    specifying authentication details

    Select Password or Key pair (OpenSSL or PuTTY) and enter your password or passphrase.

    Click Next to proceed with the final configuration step.

  6. In the next dialog window, verify the path to the desired Python interpreter. You can accept default, or specify a different one. You have to configure the path mappings between your local project and the server. To do that, click the Browse button next to the Sync folders field and enter the path to the local project folder and the path to the folder on the remote server.

    Setting SSH mappings

    You can also select the lowest checkbox to enable automatic upload of the local changes to the remote server.

  7. Select the Execute code using this interpreter with root privileges via sudo checkbox to run an SSH interpreter using sudo. The root privileges will be enabled only for launching the remote interpreter. Files will be copied to the remote server with your current user privileges.

  8. Click Finish to complete adding an interpreter. In case of adding an interpreter as a root user, you will be asked to provide your password.

    Provide a sudo password

    Select Remember to keep using the password for this interpreter even you restart PyCharm. The interpreters added with root privileges are marked with sudo in the list of the available interpreters.

    Sudo interpreters

Last modified: 6 November 2019