Developing scripts remotely
Often it is more efficient to use an IDE like Visual Studio Code or a text editor like Notepad++ to modify and develop the scripts you are running in Puhti, Mahti or cPouta virtual machine.
- No need to use command line text editors like vi, vim or nano
- No need to transfer files back and forth between your local computer and Puhti/Mahti/cPouta
Here are some installation and usage instructions for the following programs:
Visual Studio Code with Remote SSH plugin
Visual Studio Code is a widely used open source code editor made by Microsoft that can be used remotely with the Remote SSH extension. It is especially great for Python and bash scripts but can be used with any programming language. VS Code has a lot of extensions for your needs, some notable are the Python extension and the Jupyter notebook extension.
You can install VS Code to your computer from the VS Code webpage and the Remote SSH Plugin from the Extension tab on the program.
Windows users also need an SSH client installed as PuTTy is not supported.
If you have access to admin privileges, you can enable the OpenSSH on Windows 10.
If you don't have access to admin privileges, you can install Git for Windows from here and configure VS Code to use the SSH client included in Git (File -> Preferences -> Settings -> search for "Remote SSH Path" and add path to your ssh.exe e.g C:\Users\YOUR_USER\AppData\Local\Programs\Git\usr\bin\ssh.exe). You might also need to disable the setting "useLocalServer" if you encounter problems with VS Code using your Windows username rather than CSC username.
After installation go to the Remote Explorer tab in VS Code and add new remote machine from the + symbol. When VS Code asks for the SSH command, type
After that you can connect to the new host and it will ask you what operation system the target machine has (Puhti is Linux) and also your CSC password.
You are now in Puhti and can open a folder and edit files remotely. Notice that you can also transfer files to Puhti/Mahti by dragging and dropping them to VS Code.
Running the code using the terminal
You can also run the code in Puhti by opening a terminal from the Terminal tab. Note that it runs the code on a login node by default which is not meant for demanding computations. You can open an interactive session with the command
Notepad++ with NppFTP plugin
Notepad++ with NppFTP plugin enables viewing and editing remote files. Also creating, renaminig and deleting files is possible.
- Install the plugin from Plugin Manager.
- Open NppFTP window from Plugins -> NppFTP.
- Set up the connection to Puhti, add new profile to Profile settings, use values similar to FileZilla Puhti settings.
- Navigate to correct folder in Puhti and open the file.
- Saving the file in Notepad++ uploads the file automatically to Puhti.