PyCharm 2024.3 Help

Vagrant

Available only in PyCharm Professional: download to try or compare editions

On this page, enable Vagrant support in PyCharm, specify the location of the VagrantFile, and handle the list of Vagrant base boxes to use in creation of virtual boxes (instances).

  1. Make sure that Vagrant and Oracle's VirtualBox are downloaded, installed, and configured on your computer as described in Vagrant: Working with Reproducible Development Environments.

  2. Make sure that 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 Vagrant installer.

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

Before you start working with Vagrant, make sure that:

  1. Vagrant is downloaded and installed.

  2. The Vagrant plugin is enabled. The plugin is bundled with PyCharm and is activated by default. If the plugin is not activated, enable it on the Plugins settings page  Ctrl+Alt+S as described in Install plugins.

Item

Description

Vagrant executable

Specify the fully qualified address of the executable file: vagrant.bat for Windows, vagrant for Unix and macOS. Type the path manually, or click the browse button and locate the desired file in the dialog that opens.

Instance folder

Specify here the fully qualified path to the directory, where the task vagrant init has been executed, and the Vagrantfile is initialized and stored.

Note that you can create an instance folder in any location, for example, in a project root. When a new remote interpreter is created, this project root location will be suggested by default as the instance folder.

A Vagrantfile is a configuration file that defines the instance (virtual machine) you need. The file contains the virtual IP address, port mappings, and the memory size to assign. The file can specify which folders are shared and which third-party software should be installed. According to the Vagrantfile your instance (virtual machine) is configured, provisioned against the relevant Vagrant base box, and deployed on your computer. A Vagrantfile is created through the vagrant init command.

When creation of an instance (virtual machine) is invoked either through the vagrant up command or through the Tools | Vagrant | Up menu option, PyCharm looks for the Vagrantfile in the directory specified in the Instance folder field. For more information, refer to http://docs.vagrantup.com/v2/vagrantfile/.

You can create a Vagrantfile in any directory and appoint it as instance folder. If the field is empty, PyCharm will treat the project root as the instance folder and look for a Vagrantfile in it.

Provider

Use this field to specify the provider to be used by vagrant up command. If this field is left blank, the default provider is used.

Environment variable

Click the ellipsis button or press Shift+Enter to specify the shell variables to be used to configure the providers' behavior.

Boxes and Plugins tabs

Boxes

This list shows the predefined Vagrant base boxes available in PyCharm.

Each item presents a Vagrant base box on which Vagrant configures and launches its instances (virtual machines). The entries of this list correspond to the output of the command vagrant box list.

the Add button

Alt+Insert

Click this button to download a new base box. This command corresponds to vagrant box add <name> <URL>. By default, PyCharm suggests the URL to the lucid32 box For more information, refer to Vagrant: Working with Reproducible Development Environments.

Remove a box

Alt+Delete

Click this button to remove the selected Vagrant base box. The box and the nested files are physically deleted from the disk. This command corresponds to vagrant box remove <name> For more information, refer to Vagrant: Working with Reproducible Development Environments.

Plugins

Use this table to view and change the list of available plugins.

the Add button

Alt+Insert

Click this button to install a new Vagrant plugin.

Remove the selected plugin

Alt+Delete

Click this button to remove the selected plugin.

Update the plugin

Click this button to update the selected plugin.

Attach a license to the plugin

Use this button to attach a license to the selected plugin.

Last modified: 17 June 2024