Remote Debugging with PyCharm Professional
In this tutorial, you can learn how to set up remote debugging with PyCharm Professional on the Neuro Platform using the Neu.ro project template.
$ pipx install neuro-all cookiecutter
$ neuro login
Then, initialize an empty project:
$ cookiecutter gh:neuro-inc/cookiecutter-neuro-project --checkout release
This command will prompt you to enter some info about your project:
project_name [Name of the project]: Neuro PyCharm
project_dir [neuro pycharm]:
preserve Neuro Flow template hints [yes]:
Next, switch to the new project's folder and configure the project's environment on the Neuro Platform:
$ cd neuro pycharm
$ neuro-flow build train
Then, you will need to exclude all directories that don't contain Python code (in an empty Neu.ro project, only the
modulesfolder will contain code). PyCharm doesn't synchronize excluded directories. Select all directories to exclude, right-click, and select Mark Directory as -> Excluded. As a result, you will see a configured project:
Run these commands to upload your code to the Neuro Platform storage:
> neuro-flow mkvolumes
> neuro-flow upload ALL
Now, we are ready to start a GPU-powered development job on the Neuro Platform. Run the following command:
> neuro-flow run remote_debug
This command starts a
remote_debugjob on the Neuro Platform. This job uses the cluster's default preset and forwards the local port 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. You can use
neuro-flow kill remote_debugto kill the job you created in the previous step or
neuro-flow kill ALLto kill all your running jobs.
Then go back to the PyCharm project and navigate to Preferences -> Project -> Project interpreter (you can also search for "interpreter"). Click the gear icon to view the project interpreter options and select Add... In the new window, select SSH Interpreter and set up the following configuration:
- Host: localhost
- Port: 2211
- Username: root
When this is done, click Next.
In the new window, specify the paths for the interpreter and synced folders:
Sync folders: <Project root> -> /neuro pycharm
Note that, within the job, your project's root folder is available at the root of the filesystem:
Click Finish, and your configuration is ready:
Once you apply the remote interpreter configuration, PyCharm will start file synchronization.
Your PyCharm project is now configured to work with a remote Python interpreter running in a Neu.ro job.
In this example, we're working with the
main.pyfile. To enter debug mode, right-click the file and click Debug 'main':
Now, you can interact with the file in debug mode: