PyCharm 2019.2 Help

Configure a remote interpreter using Vagrant

Ensure that the following prerequisites are met (outside of PyCharm):

  • Oracle's VirtualBox is installed on your computer.

  • Vagrant is installed on your computer, and all the necessary infrastructure is created.

  • The parent folders of the following executable files are added to the system PATH variable:

    • vagrant.bat or vagrant from your Vagrant installation. This should be done automatically by the installer.

    • VBoxManage.exe or VBoxManage from your Oracle's VirtualBox installation.

  • The required virtual boxes are created.

Configure a remote Python interpreter

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

  2. Ensure that you have properly initiated and started Vagrant. Basically, you need to open the Terminal window and execute the following commands:

    $ vagrant init ubuntu/trusty64
    $ vagrant up
    See Vagrant documentation for more information.

  3. In the Settings/Preferences dialog (Ctrl+Alt+S), open the Plugins page and install the Vagrant plugin.

  4. 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.

  5. In the left-hand pane of the Add Python Interpreter dialog, click Vagrant:

    Add an interpreter

  6. Click the browse button the Browse button next to the field Vagrant instance folder, and specify the desired Vagrant instance folder.

    This results in showing the link to Vagrant host URL.

  7. The Python interpreter path field displays the path to the desired Python executable. You can accept default, or specify a different one.

  8. Click OK. The configured remote interpreter is added to the list.

  9. Back in the Project Interpreter page, if necessary, configure the path mappings:

    1. Click the Browse button:

      Path mapping

    2. In the dialog that opens add Add a path mapping or delete Delete a path mapping path mappings as desired.

Last modified: 6 November 2019