Skip to main content
There are two ways to install custom packages in the E2B Sandbox.
  1. Create custom sandbox with preinstalled packages.
  2. Install packages during the sandbox runtime.

Create a custom sandbox

Use this option if you know beforehand what packages you need in the sandbox.
Sandbox templates allow you to define custom sandboxes with preinstalled packages and configurations.

1. Install the E2B SDK

Create a .env file with your API key:

2. Create a template file

Define your custom template with the packages you need.

3. Create a build script

4. Build the template

Run the build script to create your custom template:
This will build your template and you’ll see build logs in the console.

5. Use your custom sandbox

Now you can create sandboxes from your custom template:

Install packages during the sandbox runtime

Use this option if don’t know beforehand what packages you need in the sandbox. You can install packages with the package manager of your choice.
The packages installed during the runtime are available only in the running sandbox instance. When you start a new sandbox instance, the packages are not be available.

1. Install Python packages with PIP

2. Install Node.js packages with NPM

3. Install packages with package manager of your choice

Since E2B Sandboxes are Debian based machines, you can use any package manager supported by Debian. You just need to make sure that the package manager is already installed in the sandbox. For example, to install curl and git, you can use the following commands: