PyCharm 2024.1 Help

Configure an interpreter using Vagrant

Configure a remote Python interpreter

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

    • One of supported Vagrant providers 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 have been 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.

  2. Make sure that the Vagrant plugin is enabled.

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

    For more information, refer to Vagrant documentation.

  4. Do one of the following:

    • Click the Python Interpreter selector and choose Add New Interpreter.

    • Press Ctrl+Alt+S to open Settings and go to Project: <project name> | Python Interpreter. Click the Add Interpreter link next to the list of the available interpreters.

    • Click the Python Interpreter selector and choose Interpreter Settings. Click the Add Interpreter link next to the list of the available interpreters.

  5. Select On Vagrant.

  6. Specify the path to the Vagrant instance folder in Vagrant Instance Folder.

    Wait until you see a link in Vagrant Host URL.

  7. In the New Target: Vagrant dialog, click the browse icon the Browse button next to the Vagrant Instance Folder field, and specify the desired Vagrant instance folder.

    This results in showing the link to Vagrant Host URL.

    Specifying the Vagrant instance folder
  8. In the next field, PyCharm will display the path to the Python executable. Press "Next" to proceed.

    Python executable is discovered
  9. You can create a virtual environment (venv or conda) or use a system Python interpreter for the target Vagrant instance. Note that virtual environment must be configured and available in the specified Vagrant instance folder. Otherwise, the corresponding lists will be empty.

    Virtual environment on a target Vagrant instance

    Clik Create to complete the task.

Last modified: 26 May 2024