Skip to content

Commit e1293e6

Browse files
authored
Update miniconda repo location and install torch via pip. (pyro-ppl#3432)
1 parent 9174cfe commit e1293e6

File tree

3 files changed

+19
-27
lines changed

3 files changed

+19
-27
lines changed

docker/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
ARG base_img=ubuntu:18.04
5+
ARG base_img=ubuntu:24.04
66
FROM ${base_img}
77

88
# Optional args
9-
ARG cuda=0
109
ARG python_version=3
1110
ARG pyro_branch=release
11+
ARG pytorch_whl=cpu
1212
ARG pytorch_branch=release
1313
ARG uid=1000
1414
ARG gid=1000
@@ -38,7 +38,7 @@ USER ${USER_NAME}
3838

3939
# Install conda
4040
RUN wget -O ~/miniconda.sh \
41-
https://repo.continuum.io/miniconda/Miniconda${python_version%%.*}-latest-Linux-x86_64.sh && \
41+
https://repo.anaconda.com/miniconda/Miniconda${python_version%%.*}-latest-Linux-x86_64.sh && \
4242
bash ~/miniconda.sh -f -b -p ${CONDA_DIR} && \
4343
rm ~/miniconda.sh && \
4444
conda install python=${python_version}

docker/Makefile

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@
55
.PHONY: help create-host-workspace build build-gpu run run-gpu notebook notebook-gpu
66

77
DOCKER_FILE=Dockerfile
8-
BASE_IMG=ubuntu:18.04
9-
BASE_CUDA_IMG=nvidia/cuda:11.5.0-cudnn8-runtime-ubuntu18.04
8+
BASE_IMG=ubuntu:24.04
109
DOCKER_CMD=docker
11-
DOCKER_GPU_CMD=nvidia-docker
1210
HOST_WORK_DIR=${HOME}/pyro_docker
13-
UID=$(shell id -u)
14-
GID=$(shell id -g)
11+
UID=999
12+
GID=999
1513
OSTYPE=$(shell uname)
1614
USER=pyromancer
1715
DOCKER_WORK_DIR=/home/${USER}/workspace/shared
1816
pyro_git_url=https://github.com/pyro-ppl/pyro.git
1917

2018
# Optional args
21-
python_version?=3.6
19+
python_version?=3.12
2220
pytorch_branch?=release
2321
pyro_branch?=release
2422
cmd?=bash
@@ -45,12 +43,11 @@ help:
4543

4644
build: ##
4745
## Build a docker image for running Pyro on a CPU.
48-
## Requires nvidia-docker (https://github.com/NVIDIA/nvidia-docker).
4946
## Args:
50-
## python_version: version of python to use. default - python 3.6
47+
## python_version: version of python to use. default - python 3.12
5148
## pytorch_branch: whether to build PyTorch from conda or from source
5249
## (git branch specified by pytorch_branch)
53-
## default - latest pytorch version on conda
50+
## default - latest pytorch version on the torch python package index
5451
## pyro_branch: whether to use the released Pyro wheel or a git branch.
5552
## default - latest pyro-ppl wheel on pypi
5653
##
@@ -66,21 +63,20 @@ build: ##
6663

6764
build-gpu: ##
6865
## Build a docker image for running Pyro on a GPU.
69-
## Requires nvidia-docker (https://github.com/NVIDIA/nvidia-docker).
7066
## Args:
71-
## python_version: version of python to use. default - python 3.6
67+
## python_version: version of python to use. default - python 3.12
7268
## pytorch_branch: whether to build PyTorch from conda or from source
7369
## (git branch specified by pytorch_branch)
74-
## default - latest pytorch version on conda
70+
## default - latest pytorch version on the torch python package index
7571
## pyro_branch: whether to use the released Pyro wheel or a git branch.
7672
## default - latest pyro-ppl wheel on pypi
7773
##
78-
${DOCKER_GPU_CMD} build -t ${IMG_NAME} \
79-
--build-arg base_img=${BASE_CUDA_IMG} \
74+
${DOCKER_CMD} build -t ${IMG_NAME} \
75+
--build-arg base_img=${BASE_IMG} \
8076
--build-arg uid=${UID} \
8177
--build-arg gid=${GID} \
8278
--build-arg ostype=${OSTYPE} \
83-
--build-arg cuda=1 \
79+
--build-arg pytorch_whl=cu118 \
8480
--build-arg python_version=${python_version} \
8581
--build-arg pytorch_branch=${pytorch_branch} \
8682
--build-arg pyro_git_url=${pyro_git_url} \

docker/install.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,13 @@ pip install notebook ipywidgets matplotlib
1313
# Use conda package if pytorch_branch = 'release'.
1414
# Else, install from source, using git branch `pytorch_branch`
1515

16-
if [ ${pytorch_branch} = "release" ]
16+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/${pytorch_whl}
17+
if [ ${pytorch_branch} != "release" ]
1718
then
18-
conda install -y pytorch torchvision -c pytorch
19-
if [ ${cuda} = 1 ]; then conda install -y cuda90 -c pytorch; fi
20-
else
21-
conda install -y numpy pyyaml mkl mkl-include setuptools cmake cffi typing
22-
conda install -c mingfeima mkldnn
23-
if [ ${cuda} = 1 ]; then conda install -y cuda90 -c pytorch; fi
2419
git clone --recursive https://github.com/pytorch/pytorch.git
2520
pushd pytorch && git checkout ${pytorch_branch}
26-
python setup.py install
21+
pip uninstall torch
22+
pip install -e .
2723
popd
2824
fi
2925

@@ -36,5 +32,5 @@ then
3632
pip install pyro-ppl
3733
else
3834
git clone ${pyro_git_url}
39-
(cd pyro && git checkout ${pyro_branch} && pip install .[dev])
35+
(cd pyro && git checkout ${pyro_branch} && pip install -e .[dev])
4036
fi

0 commit comments

Comments
 (0)