How Do You Add the NLTK Library to a Vertex AI Workbench Jupyter Kernel?
You are working on a prototype of a text classification model in a managed Vertex AI Workbench notebook. You want to quickly experiment with tokenizing text by using a Natural Language Toolkit (NLTK) library. How should you add the library to your Jupyter kernel?
Community Votes
100% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The exam tests matching package-installation weight to the scenario — quick prototyping calls for an in-cell
!pip install --user, and the trap is over-engineering with custom images or Dataflow pipelines.
For quick prototyping in a managed Vertex AI Workbench notebook, the fastest way to add NLTK is running !pip install nltk --user in a Jupyter cell, which installs the library into the kernel's user space. The community unanimously (100% of votes) backs this approach over terminal installs, custom images, or Dataflow jobs.
Choosing A (terminal `pip install nltk`) — it seems equivalent, but a terminal shell can point to a different Python environment than the running Jupyter kernel, and without the `--user` flag it may hit permission issues or conflict with system-wide packages on managed notebooks.
Community Discussion (4 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option D installs NLTK directly from a Jupyter cell with!pip install nltk --user, placing the package in the user site-packages of the exact Python environment backing the running kernel, making it immediately importable. The question explicitly frames the task as a prototype where you want to "quickly experiment," so minimal setup overhead is the deciding factor. Comment [1] (7 likes) breaks down the three winning properties: direct installation, one-command simplicity, and the --user flag that avoids conflicts with system-wide packages. Comment [2] reinforces that this approach lets you start tokenizing immediately without managing Docker images or setting up external data-processing jobs.Why the Other Options Are Wrong
Option A installs from a terminal, which may target a different Python environment than the active Jupyter kernel and lacks the--user flag that sidesteps permission issues in managed notebooks. Option B builds a custom Dataflow job, which is a large-scale batch-processing service — massive overkill for prototyping, and it never adds NLTK to your kernel at all. Option C creates a new notebook with a custom container image; while valid for production reproducibility, building and pushing a custom image is far too slow for quick experimentation. The scenario keywords "prototype" and "quickly" rule out every heavyweight option.Community Comment Notes
Community consensus is unanimous: 100% of votes favor D, and every comment endorses it. Comment [3] simply confirms the exact command, while comment [4] — despite a typo labeling it E — describes the same!pip install --user approach and stresses efficiency and user-level installation. No comment argues for any alternative, making D a safe, high-confidence answer. Official Reference
Exam Strategy
Scan the scenario for urgency words like "quickly," "prototype," or "experiment" — they signal the lightest-weight solution that touches the notebook kernel directly. In-cell !pip install <package> --user is the go-to for ad-hoc libraries, while custom images and Dataflow are reserved for reproducibility and scale. Match solution weight to scenario scope and the distractors eliminate themselves.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →
--userflag ensures that the library is installed in the user's space, avoiding potential conflicts with system-wide packages.