nerdexam
Microsoft

DP-100 · Question #330

Drag and Drop Question You have an Azure Machine Learning workspace. You plan to use the terminal to configure a compute instance to run a notebook. You need to add a new R kernel to the compute…

The correct answer is conda create -n r_env r-essentials r-base; conda activate r_env; R; IRkernel::installspec(name = 'irenv', displayname = "New R Env"). The task involves creating a new Conda environment for R, activating it, starting an R session, installing the IRkernel specification to register it as a Jupyter kernel, and finally quitting the R session.

Explore data and run experiments

Question

Drag and Drop Question You have an Azure Machine Learning workspace. You plan to use the terminal to configure a compute instance to run a notebook. You need to add a new R kernel to the compute instance. In which order should you perform the actions? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order. Answer:

Exhibit

DP-100 question #330 exhibit

Answer Area

Drag items

IRkernel::installspec(name = 'irenv', displayname = "New R Env")Rconda activate r_envconda create -n r_env r-essentials r-base

Correct arrangement

  • conda create -n r_env r-essentials r-base
  • conda activate r_env
  • R
  • IRkernel::installspec(name = 'irenv', displayname = "New R Env")

Explanation

The task involves creating a new Conda environment for R, activating it, starting an R session, installing the IRkernel specification to register it as a Jupyter kernel, and finally quitting the R session.

Approach. The correct interaction is to drag and drop the actions into the answer area in the following order:

  1. conda create -n r_env r-essentials r-base: This command is the first step because it creates a new Conda environment named 'r_env' and installs the essential R packages (r-essentials and r-base) within it. You cannot activate or use an environment before it's created.
  2. conda activate r_env: After the environment is created, it needs to be activated. This command changes the current shell environment to use the packages and binaries from the 'r_env' environment, ensuring that subsequent R commands operate within this isolated environment.
  3. R: Once the R environment is active, this command starts an interactive R session in the terminal. R-specific commands can only be executed within an active R session.
  4. IRkernel::installspec(name = 'irenv', displayname = 'New R Env'): This command is an R function. It must be executed inside an R session. It registers the currently active R environment (which includes the IRkernel package, usually provided by r-essentials) as a Jupyter kernel, making it available for use in notebooks with the specified name ('irenv') and display name ('New R Env').
  5. q(): This R function quits the interactive R session. It's the final cleanup step after the kernel has been successfully installed.

Common mistakes.

  • common_mistake. Common mistakes include attempting to activate a Conda environment before it's created, trying to run R commands (like IRkernel::installspec or q()) before starting an R session using the R command, or placing IRkernel::installspec before the R command. For example, running R before conda activate r_env would launch the base R interpreter, not the one in the newly created environment. Similarly, trying to install the kernel spec outside of an R session would result in a 'command not found' error. Placing q() before the IRkernel::installspec would exit R before the kernel could be registered.

Concept tested. The underlying technical concept being tested is the process of managing Conda environments for data science workflows, specifically creating and activating custom environments for different language kernels (like R) and then registering those environments as Jupyter kernels within an Azure Machine Learning compute instance. This involves understanding the sequence of operations for environment setup, language interpreter initiation, and kernel installation.

Topics

#Azure Machine Learning Compute Instance#R Kernel#Terminal Configuration#Environment Management

Community Discussion

No community discussion yet for this question.

Full DP-100 Practice