Remote Connection Manager#
The Remote Connections Manager allows you to create, initiate and manage connections to external servers as well as local containers and VMs for remote development and execution of your code. Connecting to a remote host and opening a new Terminal de IPython on it allows running code, browsing files and using other Spyder features just as if you were working on your local machine.
It uses the standard, widely-used SSH protocol, which allows you to create a secure connection to remote servers, cloud resources and high-performance computing clusters, as well as local Docker containers, virtual machines (including Windows Subsystem for Linux v2), and headless devices such as the Raspberry Pi. Additionally, it supports connecting to JupyterHub servers run by your company, institution or organization and using their shared Jupyter Server environments, without the limitations of the traditional notebook interface. No configuration is required on the remote host, aside from ensuring an SSH or JupyterHub server is running and accessible.
The remote connections manager can be accessed under , and you can use to open new consoles on remote servers you’ve already configured.
Creating a new connection#
To set up a connection to a new remote server, open the remote connections manager and click New connection. You can then configure the settings appropriate to the connection method.
If your institution already has a JupyterHub server you’d like to connect to, select the JupyterHub tab. Otherwise, if you want to connect to most other types of hosts, you’ll want to use the default SSH. Either way, you’ll just need to make sure JupyterHub or SSH is available on the remote machine, and you have the appropriate credentials to connect to it.
SSH connection#
To create a new SSH connection, you need to enter several key details:
Select your authentication method, Password or Key file.
Nota
Password uses your normal username and password that you would enter when logging in to your account on the machine, while Key file uses a SSH private key you’ve generated with ssh-keygen and already registered with the remote machine. If you’re unsure, try Password to start, or ask the person who set up the host you are trying to connect to.
Type a Name for the connection, which is just used to identify it in within the Spyder interface.
Enter the IP address or hostname of the device to connect to in Remote address or host
If you or your administrator has configured different SSH port than the default
22on the remote machine (the port the SSH daemon,sshd, is listening on), enter it in the Port field.Type the Username of the account you want to connect to.
If using a Password, enter it in the corresponding field. If using a Key file, navigate to where it is located (often under
YOUR_HOME_DIR/.ssh/and calledid_rsaor similar) and enter its passphrase, if you’ve set one.Finally, you can optionally set the path to a SSH configuration file, which can contain additional advanced options for the host you set above as well as filling in default values for the previous fields.
Finally, click Connect to initiate the connection to the host, which will automatically validate and securely save all the provided details and autonomously set up the server Spyder needs to connect to on the remote host, so everything is ready for you to launch your first console.
Alternatively, you can click Save to store the details you’ve entered in a new connection without actually trying to connect.
JupyterHub connection#
If connecting to a existing JupyterHub server, the process is much simpler than SSH. Just enter what you would like to Name the connection in the Spyder interface, the Server URL to the JupyterHub server to connect to, and the access Token you were provided. Then, click Connect to connect to the server and save the provided details for future use. If you have questions about how to obtain a token, ask the person who set up the JupyterHub server or your system administrator.
Truco
To enable all of Spyder’s features when working with an existing JupyterHub deployment, ask the person who set up the server to install the Spyder-Remote-Services Jupyter Server extension.
Manage an existing connection#
You can view the remote connections you’ve already created by browsing and selecting them from the left panel of the remote connections manager. The Connection status tab shows basic details of the connection, its current state, a log of connection events and any errors to help troubleshoot problems. Under the Connection info tab, you can update any of the details you entered when Creating a new connection, using the Save button at the bottom to save your changes. Use the Connect button to initiate the selected connection, or the Remove button to delete it.
Connecting to existing kernels (advanced)#
Prudencia
This is an advanced feature for connecting to existing running kernels, which is substantially more complicated and less capable than creating and managing a connection with Spyder using the Remote Connections Manager. If possible, we recommend using the latter instead unless your use case requires it.
You can connect to external local and remote kernels (including those managed by Jupyter Notebook or QtConsole) through the Connect to an existing kernel dialog under the Consoles menu.
For this feature to work, a compatible version of the spyder-kernels package must be installed in the environment or machine in which the external kernel is running.
Conectar a un núcleo local#
Para conectarse a un núcleo local que ya se está ejecutando (por ejemplo, uno iniciado por Jupyter notebook):
Ejecuta
%connect_infoen el notebook o la consola a la que quieres conectarte, y copia el nombre de su archivo de conexión al núcleo, que se muestra después dejupyter <app> --existing.
En Spyder, haz clic en Conectarse a un núcleo existente desde el menú Terminales, y pega el nombre del Archivo de conexión del paso anterior.
Por conveniencia, los números de ID del núcleo (por ejemplo
1234) ingresados en el campo de ruta del archivo de conexión se ampliarán a la ruta completa del archivo, por ejemplojupyter/runtime/dir/path/kernal-id.json.
Haz clic en OK para conectarte al núcleo.
Conectar a un núcleo remoto#
Para conectarse a un núcleo en una máquina remota:
Inicia un núcleo Spyder en el host remoto, si aún no se está ejecutando, con
python -m spyder_kernels.console.
Copia el archivo de conexión del núcleo (
jupyter/runtime/dir/path/kernel-pid.json) a la máquina en la que estás ejecutando Spyder.Puedes obtener
jupyter/runtime/dir/pathejecutandojupyter --runtime-diren el mismo entorno de Python que el kernel. Generalmente, el archivo de conexión que estás buscando será uno de los más recientes en este directorio, correspondiente a la hora en que inició el núcleo externo.
Haz clic en Conectarse a un núcleo existente desde el menú Terminales, y busca o ingresa la ruta al archivo de conexión desde el paso anterior.
Por conveniencia, los números de ID del núcleo (por ejemplo,
1234) introducidos en el campo de ruta del archivo de conexión se expandirán ajupyter/runtime/dir/path/kernal-id.jsonen tu máquina local, si has copiado el archivo de conexión allí.
Marca la casilla Este es un núcleo remoto (via SSH) e ingresa el Servidor o dirección IP, nombre de usuario y puerto al cual conectarse en la máquina remota. Luego, ingresa la contraseña de
nombre de usuarioen la máquina remota, o selecciona un archivo de clave SSH registrado en la máquina remota, normalmente ubicado en el directorio.sshen tu carpeta de inicio en la máquina local y llamado a menudoid_rsa. Si marcas Guardar ajustes de conexión, estos detalles serán recordados y rellenados automáticamente la próxima vez que abras el diálogo.Note that Port is the port number on your remote machine that the SSH daemon (
sshd) is listening on, typically22unless you or your administrator has configured it otherwise.
Haz clic en OK para conectarte al núcleo
Para obtener más detalles técnicos sobre la conexión a los núcleos remotos, consulta la página Connecting to a remote kernel en el libro de Cookbook IPython.