Learning resourcesReviewed · E2B

E2B: Install custom packages

E2B’s Install custom packages guide helps developers add dependencies to E2B sandboxes, but packages installed at runtime are unavailable in new sandbox instances. It covers reusable templates and runtime installation through pip, npm and Debian-supported package managers.

Researched 13 Nov 2026

In short.

E2B’s Install custom packages guide teaches Python and JavaScript/TypeScript developers how to add sandbox dependencies, with the main catch that runtime installations apply only to the running instance. It demonstrates building a reusable template with preinstalled packages and installing packages through commands during a session. The template instructions use the e2b SDK, while the runtime examples use separate code-interpreter imports whose installation steps are not supplied. SDK compatibility, execution results and costs are not established.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete captured page at [https://docs.e2b.dev/quickstart/install-custom-packages.md], including its documentation-index notice, both language variants of the template instructions, runtime pip and npm examples, Debian package-manager example and instance-lifetime warning. Linked pages and documentation-index contents are excluded. No code was executed; template builds, installations, sample execution, compatibility, performance and security behavior remain untested.

The overview

Identity

This is E2B’s documentation tutorial for installing custom packages in its sandboxes [https://docs.e2b.dev/quickstart/install-custom-packages.md]. It teaches a specific configuration task through Python and JavaScript/TypeScript examples; it does not provide a general evaluation of E2B.

Assessment

The guide is useful when a sandbox needs libraries or command-line tools beyond its starting environment. Its clearest practical distinction is whether dependencies are known before creation: templates prepare them in advance, while runtime commands install them in an individual session.

The template route includes installation, definition, build and sandbox-creation steps. The runtime route provides shorter examples but leaves the corresponding SDK installation steps unspecified. Successful execution and suitability for a particular workload remain unverified.

Users

The guide suits developers configuring E2B execution environments from Python or JavaScript/TypeScript. Beginners get concrete commands and small examples, but need familiarity with scripts, imports, package managers and environment variables.

Experienced developers can use it to understand dependency installation and its lifetime. It does not establish how to manage dependency conflicts, private registries or reproducible builds across a larger project.

Capabilities

Templates can preinstall Python and Node.js packages using pipInstall and npmInstall in TypeScript, or pip_install and npm_install in Python. The examples derive a template from code-interpreter-v1 and create sandboxes from the resulting custom-packages template.

Runtime examples install packages through sbx.commands.run and then invoke code through the code-interpreter SDK. The page also demonstrates installing curl and git with apt-get. Other Debian-supported package managers can be used if already installed in the sandbox.

Using it

Requirements

The template instructions require an E2B API key, the e2b SDK and dotenv or python-dotenv. They use a .env entry named E2B_API_KEY and load it in the build script.

Runtime examples instead import Sandbox from @e2b/code-interpreter in JavaScript or e2b_code_interpreter in Python. The page does not include installation commands for these runtime SDKs or specify compatible SDK versions. A chosen runtime package manager must already be available in the sandbox.

Mechanism

The template route moves package installation into a build step. A Template definition starts from code-interpreter-v1, adds package-installation steps and is built under the name custom-packages. Sandbox.create("custom-packages") then creates an instance with those packages preinstalled.

The runtime route sends installation commands into an existing sandbox. The documentation explicitly limits those installed packages to that running instance; creating a new instance does not carry them over.

Setup

For templates, the documented starting commands are npm install e2b dotenv or pip install e2b python-dotenv. After configuring E2B_API_KEY, create template.ts or template.py and add the required pip and npm packages.

Create the corresponding build.prod.ts or build.prod.py script and call Template.build with the template name. The example requests 2 CPUs and 2048 MB memory and enables build logging. Run npx tsx build.prod.ts or python build.prod.py, then create a sandbox using the built template’s name.

Example

The Python runtime example creates a sandbox, calls sbx.commands.run("pip install cowsay"), and then uses sbx.run_code to import cowsay and request a Hello, world! greeting. This illustrates installing a dependency before executing code that imports it.

The template example installs both Python and npm packages named cowsay before sandbox creation. These examples contain no captured execution output, and their behavior has not been independently verified.

Assessment & evidence

Limitations

Runtime installations do not become part of subsequent sandbox instances. The package-manager examples also depend on that manager already being installed; the Debian basis does not establish compatibility with every package.

The examples do not pin SDK or cowsay versions and do not cover installation failures, dependency conflicts, private registries or recovery. Package compatibility, build success, execution behavior, security properties and performance are untested.

Choosing an approach

Use the template route when dependencies are known in advance and should be present whenever a sandbox is created from that template. Use runtime installation when dependency needs emerge during a session and instance-local availability is sufficient.

Avoiding repeated installation commands across new instances is a practical implication of preinstalled templates. The page supplies no measurements showing how much time either approach takes or how their reliability compares.

Alternatives

The documented alternatives are two approaches within E2B: build dependencies into a template or install them during runtime. Within runtime installation, pip handles the Python example, npm handles the Node.js example, and apt-get installs system tools.

The page does not compare other sandbox services or execution environments. Their relative features, portability and costs are not assessed.

Evidence

The evidence is the complete E2B documentation page [https://docs.e2b.dev/quickstart/install-custom-packages.md]. Its code examples support the described API calls, and its explicit runtime notice establishes the instance-lifetime limitation.

The page includes no test results, benchmark measurements or successful build receipts. Its documentation-index link is a navigation notice, not additional evidence about compatibility or execution.

Access & freshness

Costs

The page gives no prices, free allowances, account quotas or billing rules. Template-build costs and sandbox usage costs are unknown.

The build example’s 2 CPUs and 2048 MB memory are configuration values, not a stated minimum, a benchmark or a cost estimate.

Rights

The page states no licence or redistribution terms for its documentation or code examples. Rights to redistribute those materials are unknown from this evidence. Licences for the SDKs and installed dependencies are also not supplied.

Freshness

The page was captured on 13 November 2026 at 03:07 UTC. It states no publication or update date and identifies no SDK release.

The code-interpreter-v1 identifier names the base template used in the examples; it does not establish an SDK version. Compatibility with current SDK releases is unknown.

Next steps

Choose the installation route according to when dependencies become known and whether they must be available in new instances. Confirm the relevant SDK installation steps and compatible versions before following the examples.

For a trial, validate a required dependency with your own workload. For templates, check its availability in a newly created sandbox from the built template; for runtime installation, account for installing it in each instance. Obtain current prices, account limits and dependency licence details separately.

Evidence for this report

selected-page.txtselected · checked 2026-11-13