Configuring Remote Python Interpreters
In this section:
- Configuring remote Python interpreter
- Important notes
- Configuring a remote PHP interpreter in a Docker container
Before you start working with remote interpreters, make sure that the SSH Remote Run plugin is enabled. The plugin is bundled with PyCharm and is activated by default. If it is not, enable the plugin as described in Enabling and Disabling Plugins.
Configuring remote Python interpreter
PyCharm provides full integration with the Python interpreters running on remote hosts.
Note that the name of a remote interpreter is automatically prepended with the prefix
To configure a remote Python interpreter, follow these general steps
- In the Project Interpreter page of the project settings, click .
- In the drop-down list, choose .
- Depending on the selection in the dialog box that opens, follow one of the procedures:
When a remote Python interpreter is added, at first the PyCharm helpers are copied to the remote host. PyCharm helpers are needed to run remotely the packaging tasks, debugger, tests and other PyCharm features. Next, the skeletons for binary libraries are generated and copied locally. Also all the Python library sources are collected from the Python paths on a remote host and copied locally along with the generated skeletons. Storing skeletons and all Python library sources locally is required for resolve and completion to work correctly in PyCharm.
PyCharm checks remote helpers version on every remote run, so if you update your PyCharm version, the new helpers will be uploaded automatically and you don't need to recreate remote interpreter.
SFTP support is required for copying helpers to the server.
Configuring a remote PHP interpreter in a Docker container
You can quickly bootstrap your PHP application with Docker, PyCharm will take care of the initial configuration
by automatically creating a new
Dockerfile, keeping your source code up-to-date and installing the necessary dependencies
in the container. Configuring a PHP environment running in a Docker container as a PHP remote interpreter lets
you run, debug, and profile your PHP application from PyCharm.
Before you start:
- Make sure that Docker and Oracle's VirtualBox are downloaded, installed, and configured on your computer as described in Docker.
- Configure the PHP development environment in the Docker container to be used.
Learn more about using Docker with PyCharm in Docker.
To configure a PHP interpreter in a Docker container:
- Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing for Windows and Linux or for OS X, and click PHP under Languages&Frameworks.
- On the PHP page that opens, click the button next to the CLI Interpreter drop-down list in the Development environment section.
- In the CLI Interpreters dialog box that opens, click the Add toolbar button in the left-hand pane, then choose Remote on the context menu.
- In the Configure Remote PHP Interpreter dialog box that opens, choose the Docker method.
- In the Server field, specify the Docker configuration to use, see Working with Docker: Process overview. Choose a configuration from the drop-down list or click next to it and create a new configuration in the Docker dialog box that opens.
In the Image name field,
specify the base Docker image to use. Choose one of the previously downloaded or your custom images
from the drop-down list or type the image name manually, for example,
php:7.0-cli. When you later launch the run configuration, Docker will search for the specified image on your machine. If the search fails, the image will be downloaded from the image repository specified on the Docker Registry page.
Specify the location of the PHP executable file in accordance with the configuration of the
selected remote development environment.
By default PyCharm suggests the
/usr/bin/phpfolder for remote hosts and Vagrant instances and
phpfor Docker containers. To specify another folder, click the Browse button and choose the relevant folder in the dialog box that opens. Note that the PHP home directory must be open for edit.
When you click OK, PyCharm checks whether the PHP executable is actually stored in the specified folder.
- If no PHP executable is found, PyCharm displays an error message asking you whether to continue searching or save the interpreter configuration anyway.
- If the PHP executable is found, you return to the Interpreters where the installation folder and the detected version of the PHP interpreter are displayed.
Optionally, customize the configuration settings of the installation in the Additional area.
In the Debugger extension text box, specify the path to Xdebug.
This enables PyCharm to activate Xdebug when it is necessary is you have disabled it in the
php.inifile, see Configuring Xdebug for Using in the On-Demand Mode.
In the Configuration options field, compose a string of configuration directives
to be passed through the -d command line option and thus add new entries to the
php.inifile. The directives specified in this field override the default directives generated by PyCharm, such as
For example, if you specify the
-dxdebug.remote_mode=jitdirective it will override the default
-dxdebug.remote_mode=reqdirective and thus switch Xdebug to the Just-In-Time (JIT) mode, see Debugging in the Just-in-Time Mode for details.
To add a new entry, click the Add button .
In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value text boxes respectively.
You can add as many entries as you need, just keep in mind that they will be transformed into a command line with its length limited to 256 characters.
- To delete an entry, select it in the list and click the Remove button .
- To change the order of entries, use the Up and Down buttons.
- To add a new entry, click the Add button . In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value text boxes respectively.
- In the Configuration options field, compose a string of configuration directives to be passed through the -d command line option and thus add new entries to the
- Click the Show phpinfo button to have PyCharm display a separate information window where you can examine the installation details and view the list of loaded extension and configured options. Please note that the options specified in the Configuration Options field of the CLI Interpreters dialog box are not listed.