In this tutorial, we show how to set up remote debugging with PyCharm Professional on Neuro Platform using the Neuro project template.
First, ensure that you have neuro
client installed and configured:
pip install -U neuromationneuro login
Then, initialize an empty project:
neuro project init
This command asks several questions about your project:
project_name [Name of the project]: Neuro PyCharmproject_slug [neuro-pycharm]:code_directory [modules]:
Next, configure the project's environment on Neuro Platform:
neuro-flow build myimage
Open the project created on the previous step in Pycharm Professional and add sample code to debug (in this example, we use code snipped taken from JetBrains documentation).
Then, exclude all directories that don't contain Python code (in an empty Neuro project, only modules/
is supposed to contain code). PyCharm does not synchronize excluded directories. For that, select all directories to exclude, mouse right-click, "Mark Directory as" -> "Excluded". As a result, you will see a configured project:
Run this command to upload your code to the Neuro Platform storage:
neuro-flow upload ALL
Now, we are ready to start a development GPU-powered job on Neuro Platform. In the shell, run:
neuro-flow run remote_debug
This command starts a remote_debug
job on Neuro Platform, which uses gpu-small
preset and forwards local post 2211 to the job's SSH port. All running jobs consume your quota, so please don't forget to terminate your jobs when they are no longer needed (for that, you can run neuro-flow kill ALL
).
Then go back to PyCharm project, go to "File" -> "Settings", "Project" -> "Project interpreter" (you can use search by the word "interpreter"). Press on the gear sign to see project interpreter options, select "Add...". In the new window, select "SSH Interpreter", and set up the following configuration:
Host: localhostPort: 2211Username: root
Press the Next button.
In the new window, specify paths:
Interpreter: /opt/conda/bin/pythonSync folders: <Project root> -> /neuro-pycharm
Note, within the job, your project root is available at the root of the filesystem: /{project_name}
Press the Finish button, and your configuration is ready:
Press the OK button.
Once you applied remote interpreter configuration, PyCharm starts files synchronization.
Congratulations! Your PyCharm project is now configured to work with remote Python interpreter running on Neuro job:
Note: if your project mapping was not configured and the remote interpreter attempts to execute a file with a local path on the remote environment, you might need to specify mapping again: "Run" -> "Edit Configurations..." -> "Path mappings":