Created
April 25, 2018 18:38
-
-
Save michaelschwier/61b43ab8f18ec89bda40959ba89e3c8f to your computer and use it in GitHub Desktop.
Creates a Docker to reproduce the "undefined symbol: _ZNK6google8protobuf7Message13SpaceUsedLongEv" error om ONNX/Caffe2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile to reproduce the error: | |
# "undefined symbol: _ZNK6google8protobuf7Message13SpaceUsedLongEv" | |
# When using current ONNX with current Caffe2 | |
# Use an official ubuntu runtime as a parent image | |
FROM ubuntu:16.04 | |
# Set the working directory to /app | |
WORKDIR /app | |
# Install dependencies (according to Caffe2 documentation) | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
cmake \ | |
git \ | |
libgoogle-glog-dev \ | |
libgtest-dev \ | |
libiomp-dev \ | |
libleveldb-dev \ | |
liblmdb-dev \ | |
libopencv-dev \ | |
libopenmpi-dev \ | |
libsnappy-dev \ | |
libprotobuf-dev \ | |
openmpi-bin \ | |
openmpi-doc \ | |
protobuf-compiler \ | |
python-dev \ | |
python-pip | |
# Install python packages | |
RUN pip install --upgrade pip setuptools wheel | |
RUN pip install future numpy protobuf | |
# Additional ubuntu 16.04 dependency (according to Caffe2 documentation) | |
RUN apt-get install -y --no-install-recommends libgflags-dev | |
# Caffe2 installation (which is a part of pytorch now) | |
RUN git clone --recursive https://github.com/pytorch/pytorch.git | |
RUN cd pytorch \ | |
&& git submodule update --init \ | |
&& mkdir build && cd build \ | |
&& cmake .. \ | |
-DUSE_CUDA=OFF \ | |
-DUSE_NNPACK=OFF \ | |
-DUSE_ROCKSDB=OFF \ | |
-DUSE_MPI=OFF \ | |
&& make -j"$(nproc)" install \ | |
&& ldconfig \ | |
&& make clean \ | |
&& cd .. | |
# Install onnx | |
RUN pip install --trusted-host pypi.python.org onnx | |
RUN printf '%s\n' 'import onnx' 'import caffe2.python.onnx.backend' >test.py | |
ENV PYTHONPATH /usr/local | |
# Run test.py when the container launches | |
CMD ["python", "test.py"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This file simply follows the Caffe2 installation documentation and additionally installs ONNX plus a few other required dependencies (setuptools wheel) and creates a simple test.py, which will yield the ImportError