Skip to content

Commit 83af9a8

Browse files
authored
Improve dev container conda consistency (#1873)
<!-- .github/pull_request_template.md --> ## 📌 Description Current dev container docker building installed the conda at `/opt/conda`, which is the root owned path. This PR improves the installation of conda for dev container to `/home/devuser/conda`, as setting before #1791. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [x] Tests have been added or updated as needed. - [x] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. -->
1 parent 0b1d8a6 commit 83af9a8

9 files changed

+107
-155
lines changed

docker/Dockerfile.cu126

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y \
1010

1111
# Install python
1212
COPY install/install_python.sh /install/install_python.sh
13-
RUN bash /install/install_python.sh py312
13+
RUN bash /install/install_python.sh /opt/conda py312
1414

1515
# Set home directory
1616
WORKDIR /workspace

docker/Dockerfile.cu126.dev

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,6 @@ RUN apt-get update && apt-get install -y \
1313
zsh \
1414
&& rm -rf /var/lib/apt/lists/*
1515

16-
# Install python
17-
COPY install/install_python.sh /install/install_python.sh
18-
RUN bash /install/install_python.sh py312
19-
20-
# Set home directory
21-
WORKDIR /workspace
22-
23-
RUN echo "source activate py312" >> ~/.bashrc
24-
ENV PATH="/opt/conda/bin:$PATH"
25-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
26-
27-
# Install torch and other python packages
28-
COPY install/install_python_packages.sh /install/install_python_packages.sh
29-
RUN bash /install/install_python_packages.sh cu126 && pip3 install pre-commit
30-
31-
# Install mpi4py in the conda environment
32-
RUN conda install -n py312 -y mpi4py
33-
34-
# Install oh-my-zsh
35-
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
36-
37-
# Install zsh-autosuggestions
38-
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
39-
40-
# Configure zsh
41-
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
42-
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
43-
4416
# Create a non-root user
4517
ARG USERNAME=devuser
4618
ARG USER_UID=1003
@@ -60,21 +32,37 @@ RUN groupadd --gid $USER_GID $USERNAME \
6032
# Ref: https://github.com/rapidsai/devcontainers/pull/373
6133
RUN if grep ubuntu:x:1000:1000 /etc/passwd >/dev/null; then userdel -f -r ubuntu; fi
6234

63-
# Copy zsh configuration to the new user's home
64-
RUN cp -r /root/.oh-my-zsh /home/$USERNAME/.oh-my-zsh && \
65-
cp /root/.zshrc /home/$USERNAME/.zshrc && \
66-
chown -R $USERNAME:$USERNAME /home/$USERNAME/.oh-my-zsh && \
67-
chown $USERNAME:$USERNAME /home/$USERNAME/.zshrc
68-
6935
# Switch to non-root user
7036
USER $USERNAME
7137
WORKDIR /home/$USERNAME
7238

39+
# Install python
40+
COPY install/install_python.sh /install/install_python.sh
41+
RUN bash /install/install_python.sh /home/$USERNAME/conda py312
42+
43+
RUN echo "source activate py312" >> ~/.bashrc
44+
ENV PATH="/home/$USERNAME/conda/bin:$PATH"
45+
ENV PATH="/home/$USERNAME/conda/envs/py312/bin:$PATH"
46+
47+
# Install torch and other python packages
48+
COPY install/install_python_packages.sh /install/install_python_packages.sh
49+
RUN bash /install/install_python_packages.sh cu126 && pip3 install pre-commit
50+
51+
# Install mpi4py in the conda environment
52+
RUN conda install -n py312 -y mpi4py
53+
54+
# Install oh-my-zsh
55+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
56+
57+
# Install zsh-autosuggestions
58+
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
59+
60+
# Configure zsh
61+
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
62+
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
63+
7364
# clangd
7465
ENV PATH="/usr/lib/llvm-19/bin:$PATH"
75-
# conda
76-
ENV PATH="/opt/conda/bin:$PATH"
77-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
7866

7967
# Triton
8068
ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas"

docker/Dockerfile.cu128

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y \
1010

1111
# Install python
1212
COPY install/install_python.sh /install/install_python.sh
13-
RUN bash /install/install_python.sh py312
13+
RUN bash /install/install_python.sh /opt/conda py312
1414

1515
# Set home directory
1616
WORKDIR /workspace

docker/Dockerfile.cu128.dev

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,6 @@ RUN apt-get update && apt-get install -y \
1313
zsh \
1414
&& rm -rf /var/lib/apt/lists/*
1515

16-
# Install python
17-
COPY install/install_python.sh /install/install_python.sh
18-
RUN bash /install/install_python.sh py312
19-
20-
# Set home directory
21-
WORKDIR /workspace
22-
23-
RUN echo "source activate py312" >> ~/.bashrc
24-
ENV PATH="/opt/conda/bin:$PATH"
25-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
26-
27-
# Install torch and other python packages
28-
COPY install/install_python_packages.sh /install/install_python_packages.sh
29-
RUN bash /install/install_python_packages.sh cu128 && pip3 install pre-commit
30-
31-
# Install mpi4py in the conda environment
32-
RUN conda install -n py312 -y mpi4py
33-
34-
# Install oh-my-zsh
35-
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
36-
37-
# Install zsh-autosuggestions
38-
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
39-
40-
# Configure zsh
41-
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
42-
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
43-
4416
# Create a non-root user
4517
ARG USERNAME=devuser
4618
ARG USER_UID=1003
@@ -60,21 +32,37 @@ RUN groupadd --gid $USER_GID $USERNAME \
6032
# Ref: https://github.com/rapidsai/devcontainers/pull/373
6133
RUN if grep ubuntu:x:1000:1000 /etc/passwd >/dev/null; then userdel -f -r ubuntu; fi
6234

63-
# Copy zsh configuration to the new user's home
64-
RUN cp -r /root/.oh-my-zsh /home/$USERNAME/.oh-my-zsh && \
65-
cp /root/.zshrc /home/$USERNAME/.zshrc && \
66-
chown -R $USERNAME:$USERNAME /home/$USERNAME/.oh-my-zsh && \
67-
chown $USERNAME:$USERNAME /home/$USERNAME/.zshrc
68-
6935
# Switch to non-root user
7036
USER $USERNAME
7137
WORKDIR /home/$USERNAME
7238

39+
# Install python
40+
COPY install/install_python.sh /install/install_python.sh
41+
RUN bash /install/install_python.sh /home/$USERNAME/conda py312
42+
43+
RUN echo "source activate py312" >> ~/.bashrc
44+
ENV PATH="/home/$USERNAME/conda/bin:$PATH"
45+
ENV PATH="/home/$USERNAME/conda/envs/py312/bin:$PATH"
46+
47+
# Install torch and other python packages
48+
COPY install/install_python_packages.sh /install/install_python_packages.sh
49+
RUN bash /install/install_python_packages.sh cu128 && pip3 install pre-commit
50+
51+
# Install mpi4py in the conda environment
52+
RUN conda install -n py312 -y mpi4py
53+
54+
# Install oh-my-zsh
55+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
56+
57+
# Install zsh-autosuggestions
58+
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
59+
60+
# Configure zsh
61+
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
62+
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
63+
7364
# clangd
7465
ENV PATH="/usr/lib/llvm-19/bin:$PATH"
75-
# conda
76-
ENV PATH="/opt/conda/bin:$PATH"
77-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
7866

7967
# Triton
8068
ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas"

docker/Dockerfile.cu129

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y \
1010

1111
# Install python
1212
COPY install/install_python.sh /install/install_python.sh
13-
RUN bash /install/install_python.sh py312
13+
RUN bash /install/install_python.sh /opt/conda py312
1414

1515
# Set home directory
1616
WORKDIR /workspace

docker/Dockerfile.cu129.dev

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,6 @@ RUN apt-get update && apt-get install -y \
1313
zsh \
1414
&& rm -rf /var/lib/apt/lists/*
1515

16-
# Install python
17-
COPY install/install_python.sh /install/install_python.sh
18-
RUN bash /install/install_python.sh py312
19-
20-
# Set home directory
21-
WORKDIR /workspace
22-
23-
RUN echo "source activate py312" >> ~/.bashrc
24-
ENV PATH="/opt/conda/bin:$PATH"
25-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
26-
27-
# Install torch and other python packages
28-
COPY install/install_python_packages.sh /install/install_python_packages.sh
29-
RUN bash /install/install_python_packages.sh cu129 && pip3 install pre-commit
30-
31-
# Install mpi4py in the conda environment
32-
RUN conda install -n py312 -y mpi4py
33-
34-
# Install oh-my-zsh
35-
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
36-
37-
# Install zsh-autosuggestions
38-
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
39-
40-
# Configure zsh
41-
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
42-
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
43-
4416
# Create a non-root user
4517
ARG USERNAME=devuser
4618
ARG USER_UID=1003
@@ -60,21 +32,37 @@ RUN groupadd --gid $USER_GID $USERNAME \
6032
# Ref: https://github.com/rapidsai/devcontainers/pull/373
6133
RUN if grep ubuntu:x:1000:1000 /etc/passwd >/dev/null; then userdel -f -r ubuntu; fi
6234

63-
# Copy zsh configuration to the new user's home
64-
RUN cp -r /root/.oh-my-zsh /home/$USERNAME/.oh-my-zsh && \
65-
cp /root/.zshrc /home/$USERNAME/.zshrc && \
66-
chown -R $USERNAME:$USERNAME /home/$USERNAME/.oh-my-zsh && \
67-
chown $USERNAME:$USERNAME /home/$USERNAME/.zshrc
68-
6935
# Switch to non-root user
7036
USER $USERNAME
7137
WORKDIR /home/$USERNAME
7238

39+
# Install python
40+
COPY install/install_python.sh /install/install_python.sh
41+
RUN bash /install/install_python.sh /home/$USERNAME/conda py312
42+
43+
RUN echo "source activate py312" >> ~/.bashrc
44+
ENV PATH="/home/$USERNAME/conda/bin:$PATH"
45+
ENV PATH="/home/$USERNAME/conda/envs/py312/bin:$PATH"
46+
47+
# Install torch and other python packages
48+
COPY install/install_python_packages.sh /install/install_python_packages.sh
49+
RUN bash /install/install_python_packages.sh cu129 && pip3 install pre-commit
50+
51+
# Install mpi4py in the conda environment
52+
RUN conda install -n py312 -y mpi4py
53+
54+
# Install oh-my-zsh
55+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
56+
57+
# Install zsh-autosuggestions
58+
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
59+
60+
# Configure zsh
61+
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
62+
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
63+
7364
# clangd
7465
ENV PATH="/usr/lib/llvm-19/bin:$PATH"
75-
# conda
76-
ENV PATH="/opt/conda/bin:$PATH"
77-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
7866

7967
# Triton
8068
ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas"

docker/Dockerfile.cu130

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y \
1010

1111
# Install python
1212
COPY install/install_python.sh /install/install_python.sh
13-
RUN bash /install/install_python.sh py312
13+
RUN bash /install/install_python.sh /opt/conda py312
1414

1515
# Set home directory
1616
WORKDIR /workspace

docker/Dockerfile.cu130.dev

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,6 @@ RUN apt-get update && apt-get install -y \
1313
zsh \
1414
&& rm -rf /var/lib/apt/lists/*
1515

16-
# Install python
17-
COPY install/install_python.sh /install/install_python.sh
18-
RUN bash /install/install_python.sh py312
19-
20-
# Set home directory
21-
WORKDIR /workspace
22-
23-
RUN echo "source activate py312" >> ~/.bashrc
24-
ENV PATH="/opt/conda/bin:$PATH"
25-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
26-
27-
# Install torch and other python packages
28-
COPY install/install_python_packages.sh /install/install_python_packages.sh
29-
# use nightly/cu130 temporarily and change to cu130 when torch releases stable version
30-
RUN bash /install/install_python_packages.sh nightly/cu130 && pip3 install pre-commit
31-
32-
# Install mpi4py in the conda environment
33-
RUN conda install -n py312 -y mpi4py
34-
35-
# Install oh-my-zsh
36-
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
37-
38-
# Install zsh-autosuggestions
39-
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
40-
41-
# Configure zsh
42-
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
43-
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
44-
4516
# Create a non-root user
4617
ARG USERNAME=devuser
4718
ARG USER_UID=1003
@@ -61,21 +32,38 @@ RUN groupadd --gid $USER_GID $USERNAME \
6132
# Ref: https://github.com/rapidsai/devcontainers/pull/373
6233
RUN if grep ubuntu:x:1000:1000 /etc/passwd >/dev/null; then userdel -f -r ubuntu; fi
6334

64-
# Copy zsh configuration to the new user's home
65-
RUN cp -r /root/.oh-my-zsh /home/$USERNAME/.oh-my-zsh && \
66-
cp /root/.zshrc /home/$USERNAME/.zshrc && \
67-
chown -R $USERNAME:$USERNAME /home/$USERNAME/.oh-my-zsh && \
68-
chown $USERNAME:$USERNAME /home/$USERNAME/.zshrc
69-
7035
# Switch to non-root user
7136
USER $USERNAME
7237
WORKDIR /home/$USERNAME
7338

39+
# Install python
40+
COPY install/install_python.sh /install/install_python.sh
41+
RUN bash /install/install_python.sh /home/$USERNAME/conda py312
42+
43+
RUN echo "source activate py312" >> ~/.bashrc
44+
ENV PATH="/home/$USERNAME/conda/bin:$PATH"
45+
ENV PATH="/home/$USERNAME/conda/envs/py312/bin:$PATH"
46+
47+
# Install torch and other python packages
48+
COPY install/install_python_packages.sh /install/install_python_packages.sh
49+
# use nightly/cu130 temporarily and change to cu130 when torch releases stable version
50+
RUN bash /install/install_python_packages.sh nightly/cu130 && pip3 install pre-commit
51+
52+
# Install mpi4py in the conda environment
53+
RUN conda install -n py312 -y mpi4py
54+
55+
# Install oh-my-zsh
56+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
57+
58+
# Install zsh-autosuggestions
59+
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
60+
61+
# Configure zsh
62+
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
63+
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
64+
7465
# clangd
7566
ENV PATH="/usr/lib/llvm-19/bin:$PATH"
76-
# conda
77-
ENV PATH="/opt/conda/bin:$PATH"
78-
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
7967

8068
# Triton
8169
ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas"

docker/install/install_python.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ set -o pipefail
2323

2424
# Install python and pip. Don't modify this to add Python package dependencies,
2525
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
26-
bash Miniforge3.sh -b -p /opt/conda
26+
bash Miniforge3.sh -b -p $1
2727

28-
/opt/conda/bin/conda create -n $1 python=3.12
28+
$1/bin/conda create -n $2 python=3.12

0 commit comments

Comments
 (0)