mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Enable docker image build for PyTorch using specific python version (#10317)
Summary: Current Dockerfile builds pytorch using default python within miniconda, which happens to be Python 3.6 This patch allows users to specify which python should be installed in the default miniconda environment used by the pytorch dockerfile. I have tested the build for python 2.7, 3.5, 3.6 and 3.7. Python 2.7 required typing and cython Pull Request resolved: https://github.com/pytorch/pytorch/pull/10317 Differential Revision: D9204401 Pulled By: ezyang fbshipit-source-id: 11355cab3bf448bbe8369a2ed1de0d409c9a2d6e
This commit is contained in:
committed by
Facebook Github Bot
parent
66b3bae47c
commit
7d6d7bef6a
@ -211,7 +211,7 @@ python setup.py install
|
||||
|
||||
### Docker image
|
||||
|
||||
Dockerfile is supplied to build images with cuda support and cudnn v7. Build as usual
|
||||
Dockerfile is supplied to build images with cuda support and cudnn v7. You can pass -e PYTHON_VERSION=x.y flag to specificy which python to be used by Miniconda, or leave it unset to use the default. Build as usual
|
||||
```
|
||||
docker build -t pytorch -f docker/pytorch/Dockerfile .
|
||||
```
|
||||
|
@ -1,5 +1,5 @@
|
||||
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
|
||||
|
||||
ARG PYTHON_VERSION=3.6
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake \
|
||||
@ -16,8 +16,8 @@ RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-la
|
||||
chmod +x ~/miniconda.sh && \
|
||||
~/miniconda.sh -b -p /opt/conda && \
|
||||
rm ~/miniconda.sh && \
|
||||
/opt/conda/bin/conda install numpy pyyaml scipy ipython mkl mkl-include && \
|
||||
/opt/conda/bin/conda install -c pytorch magma-cuda90 && \
|
||||
/opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include cython typing && \
|
||||
/opt/conda/bin/conda install -y -c pytorch magma-cuda90 && \
|
||||
/opt/conda/bin/conda clean -ya
|
||||
ENV PATH /opt/conda/bin:$PATH
|
||||
# This must be done before pip so that requirements.txt is available
|
||||
|
Reference in New Issue
Block a user