Skip to content

Commit b8a6acf

Browse files
committed
Add changeset
1 parent a3eaf42 commit b8a6acf

File tree

5 files changed

+73
-8
lines changed

5 files changed

+73
-8
lines changed

.changeset/slow-trains-pay.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@e2b/code-interpreter-python": patch
3+
---
4+
5+
Fix problem with running multiple code interpreters at the same time

js/tests/reconnect.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test('reconnect', async () => {
66
let sandbox = await CodeInterpreter.create()
77
await sandbox.close()
88

9-
sandbox = await CodeInterpreter.reconnect(sandbox.id)
9+
sandbox = await CodeInterpreter.reconnect({sandboxID: sandbox.id, apiKey: process.env.E2B_API_KEY})
1010

1111
const result = await sandbox.notebook.execCell('x =1; x')
1212

template/e2b.Dockerfile

+57-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,66 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-ins
66
ENV PIP_DEFAULT_TIMEOUT=100 \
77
PIP_DISABLE_PIP_VERSION_CHECK=1 \
88
PIP_NO_CACHE_DIR=1 \
9-
JUPYTER_CONFIG_PATH="/home/user/.jupyter"
9+
JUPYTER_CONFIG_PATH="/root/.jupyter" \
10+
IPYTHON_CONFIG_PATH="/root/.ipython"
1011

1112

1213
COPY ./requirements.txt requirements.txt
1314
RUN pip install --no-cache-dir -r requirements.txt && ipython kernel install --name "python3" --user
14-
COPY ./jupyter_server_config.py /home/user/.jupyter/
15+
COPY ./jupyter_server_config.py $JUPYTER_CONFIG_PATH/
1516

16-
RUN mkdir -p /home/user/.ipython/profile_default
17-
COPY ipython_kernel_config.py /home/user/.ipython/profile_default/
17+
RUN mkdir -p $IPYTHON_CONFIG_PATH/profile_default
18+
COPY ipython_kernel_config.py $IPYTHON_CONFIG_PATH/profile_default/
1819

19-
COPY ./start-up.sh /home/user/.jupyter/
20-
RUN chmod +x /home/user/.jupyter/start-up.sh
20+
COPY ./start-up.sh $JUPYTER_CONFIG_PATH/
21+
RUN chmod +x $JUPYTER_CONFIG_PATH/start-up.sh
22+
23+
24+
25+
# Use the E2B-specific base image
26+
FROM e2bdev/code-interpreter:latest
27+
28+
# Set environment variables to avoid interactive prompts during package installation
29+
ENV DEBIAN_FRONTEND=noninteractive
30+
31+
# Update the package list and install necessary packages
32+
RUN apt-get update && apt-get install -y \
33+
curl \
34+
wget \
35+
git \
36+
python3 \
37+
python3-pip \
38+
&& apt-get clean \
39+
&& rm -rf /var/lib/apt/lists/*
40+
41+
# Install Node.js and npm
42+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
43+
apt-get install -y nodejs
44+
45+
# Copy the requirements.txt file into the Docker image
46+
COPY requirements.txt /tmp/requirements.txt
47+
48+
# Install Python packages from requirements.txt
49+
RUN pip3 install -r /tmp/requirements.txt
50+
51+
# Install E2B CLI
52+
RUN npm install -g @e2b/cli@latest
53+
54+
# Install additional Python packages
55+
RUN pip install e2b_code_interpreter
56+
RUN pip install litellm
57+
RUN pip install gradio
58+
59+
# Ensure Jupyter is installed and configured
60+
RUN pip3 install jupyter
61+
62+
# Create necessary Jupyter directories and files
63+
RUN mkdir -p /root/.jupyter && \
64+
echo "c.NotebookApp.ip = '0.0.0.0'" > /root/.jupyter/jupyter_notebook_config.py
65+
66+
# Ensure Jupyter kernel is properly set up
67+
RUN yes | jupyter notebook --generate-config && \
68+
jupyter kernelspec list
69+
70+
# Set the entrypoint to bash for interactive use
71+
ENTRYPOINT ["/bin/bash"]

template/jupyter_server_config.py

+5
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@
4141
# with the full knowledge of what that implies.
4242
# Default: False
4343
c.ServerApp.disable_check_xsrf = True
44+
45+
# Whether to allow the user to run the server as root.
46+
# Default: False
47+
c.ServerApp.allow_root = True
48+

template/start-up.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ function start_jupyter_server() {
55
while [[ ${response} -ne 200 ]]; do
66
echo "Waiting for Jupyter Server to start..."
77
response=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:8888/api")
8+
sleep 0.2
89
done
910
echo "Jupyter Server started"
1011

@@ -26,4 +27,7 @@ function start_jupyter_server() {
2627

2728
echo "Starting Jupyter Server..."
2829
start_jupyter_server &
29-
jupyter server --IdentityProvider.token=""
30+
jupyter server
31+
32+
33+

0 commit comments

Comments
 (0)