Spyder¶
Spyder is a free, open source, cross-platform Python language development environment that provides advanced code editing, interactive testing, debugging and other features. Use the remote Python parser using its remote connection feature.
After the instance is created, open the JuypterLab of the instance and create a new terminal. It is also possible to connect to the instance through an SSH client tool.
Execute the command in the terminal window to install and install spyder-kernels
, and start a Kernel. After startup, you need to record the prompt kernel file name, here is kernel-203.json
.
pip install spyder-kernels --no-cache
python -m spyder_kernels.console
At this point the kernel is already running. Create a new terminal window from the menu.
Execute the jupyter --runtime-dir
command in a new window to view the runtime directory. Enter the directory and view the contents of the kernel file just recorded. Copy the entire JSON content.
jupyter --runtime-dir
cd /root/.local/share/jupyter/runtime
ls
cat kernel-203.json
Copy the content to a local text editor and save it as a local JSON file. Store here to local D:\kernel.json
.
Open the Spyder editor and select Consoles - Connect to an existing kernel in the menu.
Extract the login hostname, port number and user from the login command of my instance. For example, ssh -p 39815 root@i-1.gpushare.com
, the extracted information is as follows.
Hostname | Port | Username |
---|---|---|
i-1.gpushare.com | 39815 | root |
Check the This is remote kernel option in the Spyder connection configuration. Connection file Select the JSON file you just saved. Fill in the information in the SSH configuration, Password from My Instance Click Copy Password to paste. You can check Save connection settings in the lower left corner to save the settings. Click OK.
After the connection is successful, the remote window will automatically appear in the lower right corner. Enter the Shell command beginning with ! to execute Linux commands.
Spyder cannot run local files remotely, and using Run directly will prompt that the folder or file does not exist. Use the Run cell to execute block-by-block execution with the remote parser.