Docker, jupyter and HTM

I’m trying to build a container with Nupic and Jupyter on it in order to test some example in a comfortable environment.
So I built it starting from the jupyter-base image and adding items from the numenta/numpic dockerfile.
But then I encountered an error :

running build_ext
  creating /tmp/tmpzxksrqxr/tmp
  cc -c /tmp/timer_create9h1s__or.c -o /tmp/tmpzxksrqxr/tmp/timer_create9h1s__or.o
  /tmp/timer_create9h1s__or.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   main (int argc, char **argv) {
   ^~~~
  /tmp/timer_create9h1s__or.c: In function ‘main’:
  /tmp/timer_create9h1s__or.c:2:5: warning: implicit declaration of function ‘timer_create’ [-Wimplicit-function-declaration]
       timer_create();
       ^~~~~~~~~~~~
  cc /tmp/tmpzxksrqxr/tmp/timer_create9h1s__or.o -o /tmp/tmpzxksrqxr/a.out
  /tmp/tmpzxksrqxr/tmp/timer_create9h1s__or.o: In function `main':
  timer_create9h1s__or.c:(.text+0x15): undefined reference to `timer_create'
  collect2: error: ld returned 1 exit status
  creating tmp
  creating tmp/tmpzxksrqxr
  gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c /tmp/tmpzxksrqxr/vers.cpp -o tmp/tmpzxksrqxr/vers.o --std=c++11
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  /tmp/tmpzxksrqxr/vers.cpp:4:10: fatal error: capnp/common.h: No such file or directory
   #include "capnp/common.h"
            ^~~~~~~~~~~~~~~~
  compilation terminated.
  *WARNING* no libcapnp detected or rebuild forced. Will download and build it from source now. If you have C++ Cap'n Proto installed, it may be out of date or is not being detected. Downloading and building libcapnp may take a while.
  fetching https://capnproto.org/capnproto-c++-0.6.1.tar.gz into /tmp/pip-install-q9auqzr5/pycapnp/bundled
  error: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>
  ----------------------------------------
  ERROR: Failed building wheel for pycapnp
  Running setup.py clean for pycapnp
Failed to build pycapnp
Installing collected packages: pycapnp
  Running setup.py install for pycapnp: started
    Running setup.py install for pycapnp: finished with status 'error'
    ERROR: Command errored out with exit status 1:

Any suggestions?

2 Likes

Hi @mauromussin, welcome to the forums!

A few things:

  1. What’s the host OS, is it Windows?
  2. Are you on a corporate network that could be doing HTTPS inspection?
  3. Could you share your Dockerfile?
  4. What happens if you put the following line above where it’s failing:
    RUN apt-get install ca-certificates
2 Likes

1.Linux CentOS 7, docker EE 18.06
2. yes, & having some trouble because proxy options sometimes require http:// and sometimes not
3. I will put it soon on my github repo
4. I will try in a while Failed :unamused:

Thanks a lot!

2 Likes

Are you able to share your Dockerfile, or does it have other IP in it? I can test it here to maybe rule out problems with your specific environment.

ARG BASE_CONTAINER=jupyter/base-notebook
FROM $BASE_CONTAINER
#FROM ubuntu:14.04
ENV http_proxy=http://_user_:_password_@proxy2.arpa.local:8080
ENV https_proxy=https:////_user_:_password_@proxy2.arpa.local:8080
USER root
# Install dependencies
RUN apt-get update && \
    apt-get install -y \
    curl \
    wget \
    git-core \
    gcc \
    g++ \
    cmake \
    python \
    python2.7 \
    python2.7-dev \
    zlib1g-dev \
    bzip2 \
    libyaml-dev \
    build-essential \
    emacs \
    git \
    inkscape \
    jed \
    libsm6 \
    libxext-dev \
    libxrender1 \
    lmodern \
    netcat \
    pandoc \
    python-dev \
    texlive-fonts-extra \
    texlive-fonts-recommended \
    texlive-generic-recommended \
    texlive-latex-base \
    texlive-latex-extra \
    texlive-xetex \
    tzdata \
    unzip \
    nano \
    libyaml-0-2
RUN wget http://releases.numenta.org/pip/1ebd3cb7a5a3073058d0c9552ab074bd/get-pip.py -O - | python
RUN pip install --proxy proxy2.arpa.local:8080--upgrade setuptools
RUN pip install --proxy proxy2.arpa.local:8080 wheel
ENV http_proxy=proxy2.arpa.local:8080
ENV https_proxy=proxy2.arpa.local:8080
RUN apt-get install ca-certificates
RUN pip install numpy
RUN pip install Cython
RUN pip install pycapnp

# Use gcc to match nupic.core binary
ENV CC gcc
ENV CXX g++

# Set enviroment variables needed by NuPIC
ENV NUPIC /usr/local/src/nupic
ENV NTA_DATA_PATH /usr/local/src/nupic/prediction/data

ENV http_proxy=_user_:_password_@proxy2.arpa.local:8080
ENV https_proxy=_user_:_password_@proxy2.arpa.local:8080

# OPF needs this
ENV USER docker

# Set up nupic.core
#RUN pip install numpy
#RUN pip install pycapnp
RUN git clone https://github.com/numenta/nupic.core /usr/local/src/nupic.core
WORKDIR /usr/local/src/nupic.core
RUN mkdir -p build/scripts
WORKDIR /usr/local/src/nupic.core/build/scripts
RUN cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../release -DPY_EXTENSIONS_DIR=../../bindings/py/nupic/bindings ../..
RUN make install
WORKDIR /usr/local/src/nupic.core
RUN python setup.py install

# Copy context into container file system
ADD . $NUPIC

WORKDIR /usr/local/src/nupic

# Install NuPIC with using SetupTools
RUN python setup.py install

WORKDIR /home/docker

1 Like

Just to set expectation as a fellow python user who’s often behind a corporate firewall, I can promise you that frustration lies ahead.

The HTTPS proxy will most likely be using a self signed certificate that isn’t trusted by your docker container. You can verify this by trying the whole thing off-network without a proxy, e.g. tether to your cell phone via hotspot.

You could test to see if your host OS has already been configured to trust the cert, by doing something like:
curl https://capnproto.org/capnproto-c++-0.6.1.tar.gz
(from the host, not within the docker container)

If that works, you could try to map the host certificate store into the docker container as a volume, so that the container also trusts the self-signed cert, per this discussion. I think these would be under /etc/pki/ca-trust/

1 Like

I got further (I removed the proxy stuff from the dockerfile), so likely related to the proxy. Ran into a problem later, where python version is wrong, so just a heads up on that.

1 Like

Ran into a problem later, where python version is wrong, so just a heads up on that.

So it’s not just the proxy, isn’t it? A Python version problem too?

Yes, after you solve the proxy issue, you’ll need to look at that (needs Python 2, but using Python 3)

Thanks. I’ll check.

I’ve made a git repo and I’m trying to build the image using play-with-docker.
Unfortunately I had an error

[ 39%] Building CXX object src/CMakeFiles/nupic_core_solo.dir/nupic/py_support/NumpyArrayObject.cpp.o

In file included from /usr/local/src/nupic.core/src/nupic/py_support/NumpyArrayObject.cpp:28:0:
/usr/local/src/nupic.core/src/nupic/py_support/NumpyArrayObject.hpp:42:10:
fatal error: numpy/arrayobject.h: No such file or directory
#include <numpy/arrayobject.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I’m stuck…