How to auto start jupyter notebook with python create pod

As the title asks
34 Replies
nerdylive
nerdylive7d ago
Well you simply start jupyter using the template
Asad Jamal Cognify
Where is the option?
No description
nerdylive
nerdylive7d ago
try browsing how to start jupyter i try not to spoonfeed
Madiator2011 (Work)
runpod pytorch template has it enabled
Asad Jamal Cognify
It wont start for me. I am using runpod/pytorch:2.2.0-py3.10-cuda12.1.1-devel-ubuntu22.04 as container image
pod = runpod.create_pod(
name=task.bot_name,
image_name="runpod/pytorch:2.2.0-py3.10-cuda12.1.1-devel-ubuntu22.04",
gpu_count=1,
gpu_type_id='NVIDIA A40',
network_volume_id="123456",
volume_mount_path="/workspace",
ports= "8888/http,5000/http,22/tcp",
env={"PUBLIC_KEY": "ssh-ed25519 AAA"}, #
docker_args="/workspace/start_inference.sh",
)
pod = runpod.create_pod(
name=task.bot_name,
image_name="runpod/pytorch:2.2.0-py3.10-cuda12.1.1-devel-ubuntu22.04",
gpu_count=1,
gpu_type_id='NVIDIA A40',
network_volume_id="123456",
volume_mount_path="/workspace",
ports= "8888/http,5000/http,22/tcp",
env={"PUBLIC_KEY": "ssh-ed25519 AAA"}, #
docker_args="/workspace/start_inference.sh",
)
No description
nerdylive
nerdylive7d ago
is docker_args cmd? is it working if you create from the UI?
digigoblin
digigoblin7d ago
It doesn't work if you override the docker start command, it gets started in the docker start command
digigoblin
digigoblin7d ago
GitHub
containers/container-template/start.sh at main · runpod/containers
🐳 | Dockerfiles for the RunPod container images used for our official templates. - runpod/containers
nerdylive
nerdylive7d ago
its in /start.sh
digigoblin
digigoblin7d ago
He overrode it
docker_args="/workspace/start_inference.sh"
docker_args="/workspace/start_inference.sh"
nerdylive
nerdylive7d ago
does && works there? like maybe sh /start.sh && that command
digigoblin
digigoblin7d ago
No start.sh has sleep infinity so anything after that will never run
nerdylive
nerdylive7d ago
oh ya... maybe call that first, if it doesn't have sleep
digigoblin
digigoblin7d ago
Have to either do it BEFORE or just include it in his override script
Asad Jamal Cognify
The script I used for overriding is the same as start.sh I modified it to add a few commands such as install nano and screen
Asad Jamal Cognify
yes. It works if I deploy a pod from UI console
digigoblin
digigoblin7d ago
Show container logs
nerdylive
nerdylive7d ago
So there is start jupyter command there in your script? Where's start jupyter function
Madiator2011 (Work)
I think he removed it
nerdylive
nerdylive7d ago
I think so
Asad Jamal Cognify
um.. its right there below setup_ssh below setup_ssh The variables are being exported, ssh web terminal is working
Asad Jamal Cognify
Is there an issue with
if [[ $JUPYTER_PASSWORD ]]; then
echo "Starting Jupyter Lab..."
if [[ $JUPYTER_PASSWORD ]]; then
echo "Starting Jupyter Lab..."
I cannot see "Starting Jupyter Lab..." in the logs
digigoblin
digigoblin7d ago
Yes, try adding JUPYTER_PASSWORD environment variable to your pod. It won't start unless the environment variable is present. Looks like start_jupyter may be missing from the Python SDK, seems to only have start_ssh and not start_jupyter to automatically inject the environment variable.
Asad Jamal Cognify
How to get the password?
digigoblin
digigoblin7d ago
Make up one and add it to the JUPYTER_PASSWORD environment variable on the pod.
nerdylive
nerdylive7d ago
it is auto generated if you create via ui i think
digigoblin
digigoblin7d ago
He created pod using SDK
nerdylive
nerdylive7d ago
Yep
Asad Jamal Cognify
Done. It is working now Yes. There was start_ssh as a boolean but no start_jupyter
digigoblin
digigoblin7d ago
Grand, you may want to consider logging a GitHub issue to add support for start_jupyter https://github.com/runpod/runpod-python
GitHub
GitHub - runpod/runpod-python: 🐍 | Python library for RunPod API an...
🐍 | Python library for RunPod API and serverless worker SDK. - GitHub - runpod/runpod-python: 🐍 | Python library for RunPod API and serverless worker SDK.
Asad Jamal Cognify
Okay, will do that