DP-100 · Question #354
You are authoring a notebook in Azure Machine Learning studio. You must install packages from the notebook into the currently running kernel. The installation must be limited to the currently…
The correct answer is B. %pip. The %pip IPython line magic installs packages directly into the Python environment of the currently running kernel, ensuring the installation is scoped to that kernel only. The !pip shell escape runs pip as a subprocess, which may target a different Python environment than the…
Question
Options
- A!pip
- B%pip
- C!conda
- D%load
How the community answered
(61 responses)- A2% (1)
- B89% (54)
- C3% (2)
- D7% (4)
Explanation
The %pip IPython line magic installs packages directly into the Python environment of the currently running kernel, ensuring the installation is scoped to that kernel only. The !pip shell escape runs pip as a subprocess, which may target a different Python environment than the active kernel - leading to packages being installed in the wrong environment. !conda similarly runs in a shell subprocess without kernel scoping. %load is used to load the contents of a file into a notebook cell, not to install packages.
Topics
Community Discussion
No community discussion yet for this question.