Skip to content

Commit

Permalink
Fixing conda test builds (pytorch#6261)
Browse files Browse the repository at this point in the history
* Moving conda test package installs into docker image

* Small nits

* Onnx setup.py still needs PROTOBUF_INCDIR passed in
  • Loading branch information
pjh5 committed Apr 5, 2018
1 parent 0b3edfd commit 38b995a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 31 deletions.
9 changes: 3 additions & 6 deletions .jenkins/caffe2/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,10 @@ if [[ "${BUILD_ENVIRONMENT}" == conda* ]]; then
export CONDA_INSTALL_LOCALLY=1
"${ROOT_DIR}/scripts/build_anaconda.sh" "$@"

# The tests all need hypothesis, tabulate, and pydot, which aren't included
# in the conda packages
conda install -y hypothesis tabulate pydot

# This build will be tested against onnx tests, which needs onnx installed.
# Onnx should be built against the same protobuf that Caffe2 uses, which is
# only installed in the conda environment when Caffe2 is.
# At this point the visible protbuf installation will be in conda, since one
# of Caffe2's dependencies uses conda, so the correct protobuf include
# headers are those in conda as well
# This path comes from install_anaconda.sh which installs Anaconda into the
# docker image
PROTOBUF_INCDIR=/opt/conda/include pip install "${ROOT_DIR}/third_party/onnx"
Expand Down
17 changes: 0 additions & 17 deletions .jenkins/caffe2/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,6 @@ if [[ "$BUILD_ENVIRONMENT" == conda* ]]; then
# docker image
PYTHON="/opt/conda/bin/python"
INSTALL_PREFIX="/opt/conda/"

# Testing requires separate packages
if [[ $BUILD_ENVIRONMENT == *gcc4* ]]; then
# These are from conda-forge
conda install -yc conda-forge hypothesis tabulate pydot networkx==2.0 click pytest scipy
# These packages are from the default channels
conda install -y opencv=3.1.0=np112py27_1 pil=1.1.7=py27_2
else
conda install -y hypothesis tabulate pydot
fi

# This build will be tested against onnx tests, which needs onnx installed.
# Onnx should be built against the same protobuf that Caffe2 uses, which is
# only installed in the conda environment when Caffe2 is.
# This path comes from install_anaconda.sh which installs Anaconda into the
# docker image
PROTOBUF_INCDIR=/opt/conda/include pip install "${ROOT_DIR}/third_party/onnx"
fi

# Add the site-packages in the caffe2 install prefix to the PYTHONPATH
Expand Down
4 changes: 4 additions & 0 deletions docker/caffe2/jenkins/common/install_anaconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ rm "$CONDA_PKG_NAME"

export PATH="/opt/conda/bin:$PATH"
echo 'export PATH=/opt/conda/bin:$PATH' > ~/.bashrc

# Install packages needed for tests, but that aren't included in the base conda
# requirements to keep them slim
conda install -y hypothesis tabulate pydot
14 changes: 6 additions & 8 deletions scripts/build_anaconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ if [[ $BUILD_ENVIRONMENT == *cuda* ]]; then
# and manually set the package name ourself.
CAFFE2_PACKAGE_NAME="${CAFFE2_PACKAGE_NAME}-cuda${CAFFE2_CUDA_VERSION}-cudnn${CAFFE2_CUDNN_VERSION}"
fi
if [[ $GCC_USE_C11 -eq 0 ]]; then
# gcc compatibility is not tracked by conda-forge, so we track it ourselves
CAFFE2_PACKAGE_NAME="${CAFFE2_PACKAGE_NAME}-gcc${GCC_VERSION:0:3}"
fi
if [[ "$(uname)" != 'Darwin' ]]; then
if [[ $BUILD_ENVIRONMENT == *full* ]]; then
CAFFE2_PACKAGE_NAME="${CAFFE2_PACKAGE_NAME}-full"
if [[ $GCC_USE_C11 -eq 0 ]]; then
# gcc compatibility is not tracked by conda-forge, so we track it ourselves
CAFFE2_PACKAGE_NAME="${CAFFE2_PACKAGE_NAME}-gcc${GCC_VERSION:0:3}"
fi
fi
if [[ $BUILD_ENVIRONMENT == *full* ]]; then
CAFFE2_PACKAGE_NAME="${CAFFE2_PACKAGE_NAME}-full"
fi
portable_sed "s/name: caffe2.*\$/name: ${CAFFE2_PACKAGE_NAME}/" "${META_YAML}"


Expand Down Expand Up @@ -139,7 +139,6 @@ if [[ "$(uname)" != 'Darwin' ]]; then
CMAKE_BUILD_ARGS+=("-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0")
# Default conda channels use gcc 7.2 (for recent packages), conda-forge uses
# gcc 4.8.5
# TODO don't do this if user also specified a channel
CAFFE2_CONDA_CHANNEL='-c conda-forge'

# opencv 3.3.1 in conda-forge doesn't have imgcodecs
Expand All @@ -148,7 +147,6 @@ if [[ "$(uname)" != 'Darwin' ]]; then
# opencv 3.1.0 for python 3 requires numpy 1.12
add_package 'numpy' '>1.11'
fi
CONDA_BUILD_ARGS+=(" -c conda-forge")
fi
fi

Expand Down

0 comments on commit 38b995a

Please sign in to comment.