Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ ModelArts/ DevEnviron/ Local IDE/ Local IDE (VS Code)/ Manually Connecting to a Notebook Instance Through VS Code

Manually Connecting to a Notebook Instance Through VS Code

Updated on 2024-08-14 GMT+08:00

A local IDE supports PyCharm and VS Code. You can use PyCharm or VS Code to remotely connect the local IDE to the target notebook instance on ModelArts for running and debugging code.

This section describes how to use VS Code to access a notebook instance.

Prerequisites

  • You have downloaded and installed VS Code. For details, see Installing VS Code.
  • Python has been installed on your local PC or server. For details, see VS Code official documentation.
  • A notebook instance has been created with remote SSH enabled. Ensure that the instance is running. For details, see Creating a Notebook Instance.
  • The address and port number of the development environment are available. To obtain the information, go to the notebook instance details page.
    Figure 1 Instance details page
  • The key pair is available.

    A key pair is automatically downloaded after you create it. Securely store your key pair. If an existing key pair is lost, create a new one.

Step 1 Add the Remote-SSH Plug-in

In the local VS Code development environment, click , enter SSH in the search box, and click install of the Remote-SSH plug-in to install the plug-in.

Figure 2 Adding the Remote-SSH plug-in

Step 2 Configure SSH

  1. In the local VS Code development environment, click on the left, select SSH Targets from the drop-down list box, and click . The SSH configuration file path is displayed.
    Figure 3 Configuring SSH Targets
  2. Click the SSH configuration path and configure SSH.
    Figure 4 SSH configuration file path
    HOST remote-dev
         hostname <Instance connection host>
         port <Instance connection port>
         user ma-user
         IdentityFile ~/.ssh/test.pem
         UserKnownHostsFile=/dev/null
         StrictHostKeyChecking no
    • HOST: name of the cloud development environment
    • HostName: address for accessing the cloud development environment. Obtain the address on the page providing detailed information of the target notebook instance.
    • Port: port number for accessing the cloud development environment. Obtain the port number on the page providing detailed information of the target notebook instance.
    • user: ma-user
    • IdentityFile: locally stored private key file of the cloud development environment. It is the key pair file in Prerequisites.
  3. Choose File > Preference > Settings > Extensions > Remote-SSH. On the Remote Platform page, click Add Item, set Item and Value, and click OK.
    Figure 5 Configuring Remote Platform

    Item: host name configured in SSH configuration

    Value: remote development environment platform

  4. Go back to the SSH Targets page and click on the right. Then, click the development environment name to open the development environment.
    Figure 6 Opening the development environment

    After the page shown in the following figure is displayed, the connection is succeeded.

    Figure 7 Remote connection succeeded
    Figure 8 Complete configuration example

Step 3 Install the Python Plug-in in the Cloud Development Environment

On the displayed VS Code page, click on the left, enter Python in the search box, and click Install.

Figure 9 Installing the Python plug-in in the cloud development environment

If the Python plug-in fails to be installed on the cloud, install it using an offline package.

Step 4 Install the Dependent Library for the Cloud Environment

After accessing the container environment, you can use different virtual environments, such as TensorFlow and PyTorch. However, in actual development, you need to install dependency packages. Then, you can access the environment through the terminal to perform operations.

  1. In VS Code, press Ctrl+Shift+P.
  2. Search for Python: Select Interpreter and select the target Python.
  3. Choose Terminal > New Terminal. The CLI of the remote container is displayed.
  4. Run the following command to install the dependency package:
    pip install spacy

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback