2

How to set the git proxy as when run with pip3 ?

Following instructions from https://github.com/nouiz/Theano-Docker

When I run docker build -t theano_simple -f Dockerfile.0.8.X.jupyter.cuda.simple . I receive error :

fatal: unable to connect to github.com:
github.com[0: 192.30.253.112]: errno=Connection timed out
github.com[1: 192.30.253.113]: errno=Connection timed out

Adding proxy parameters to docker file :

RUN git config --global http.proxy myproxy:1111
RUN git config --global https.proxy myproxy:1111

ENV HTTPS_PROXY=https://myproxy:1111 ENV HTTPS_PROXY=https://myproxy:1111 ENV https_proxy=https://myproxy:1111 ENV https_proxy=https://myproxy:1111

Here is the original docker file : https://github.com/nouiz/Theano-Docker/blob/master/Dockerfile.0.8.X.jupyter.cuda.simple

    FROM nvidia/cuda:7.5-cudnn5-devel

    MAINTAINER FIX ME <fixme@example.com>

    RUN apt-get update && apt-get install -y --no-install-recommends \
            git \
            libopenblas-dev \
            libzmq3-dev \
            python3-dev \
            python3-numpy \
            python3-pip \
            python3-scipy && \
        rm -rf /var/lib/apt/lists/*

    RUN pip3 install \
            ipykernel \
            jupyter && \
        python3 -m ipykernel.kernelspec

    RUN pip3 install nose nose-parameterized

    ENV THEANO_VERSION 0.8.2

    RUN pip3 install git+git://github.com/theano/theano.git@rel-${THEANO_VERSION}

    COPY theanorc /root/.theanorc

    COPY start-notebook.sh /usr/local/bin/

    COPY jupyter_notebook_config_simple.py /root/.jupyter/jupyter_notebook_config.py

    COPY notebook /opt/notebook

    RUN apt-get update && apt-get install -y curl
    RUN mkdir /opt/data && cd /opt/data && curl http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist_py3k.pkl.gz -o mnist.pkl.gz

Modified docker file with proxy commands :

     FROM nvidia/cuda:7.5-cudnn5-devel

        MAINTAINER FIX ME <fixme@example.com>

        RUN apt-get update && apt-get install -y --no-install-recommends \
                git \
                libopenblas-dev \
                libzmq3-dev \
                python3-dev \
                python3-numpy \
                python3-pip \
                python3-scipy && \
            rm -rf /var/lib/apt/lists/*

        RUN pip3 install \
                ipykernel \
                jupyter && \
            python3 -m ipykernel.kernelspec

        RUN pip3 install nose nose-parameterized

        ENV THEANO_VERSION 0.8.2

ENV HTTPS_PROXY=https://myproxy:1111
ENV HTTPS_PROXY=https://myproxy:1111
ENV https_proxy=https://myproxy:1111
ENV https_proxy=https://myproxy:1111

        RUN pip3 install git+git://github.com/theano/theano.git@rel-${THEANO_VERSION}

    RUN git config --global http.proxy myproxy:1111
    RUN git config --global https.proxy myproxy:1111

        COPY theanorc /root/.theanorc

        COPY start-notebook.sh /usr/local/bin/

        COPY jupyter_notebook_config_simple.py /root/.jupyter/jupyter_notebook_config.py

        COPY notebook /opt/notebook

        RUN apt-get update && apt-get install -y curl
        RUN mkdir /opt/data && cd /opt/data && curl http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist_py3k.pkl.gz -o mnist.pkl.gz

I've also tried passing the proxy as part of the pip3 install : pip3 install --proxy myproxy:1111 command but same error.

blue-sky
  • 51,962
  • 152
  • 427
  • 752
  • What happens if you exec into the docker after it's running and install it? Does that work? – Rcynic Jan 05 '17 at 16:38

3 Answers3

1
fatal: unable to connect to github.com:
github.com[0: 192.30.253.112]: errno=Connection timed out
github.com[1: 192.30.253.113]: errno=Connection timed out

The error message seem like cause by RUN pip3 install, so add proxy for git doesn't work for this.

You could try add HTTPS_PROXY env before pip install.

ENV HTTPS_PROXY=https://myproxy:1111

Using pip behind a proxy

Community
  • 1
  • 1
Shawyeok
  • 1,186
  • 1
  • 8
  • 15
  • thanks, have tried that but same error. I've updated question. – blue-sky Jan 05 '17 at 17:26
  • 1
    @blue-sky Odd! Could you test your proxy works well? `curl -x https://myproxy:1111 https://github.com/theano/theano`, if so, please change your `pip install` to `RUN pip3 install git+https://github.com/theano/theano.git@rel-${THEANO_VERSION}` – Shawyeok Jan 05 '17 at 17:42
  • 1
    It's seem `git://github.com/xxx` doesn't match the `HTTPS_PROXY`. – Shawyeok Jan 05 '17 at 17:44
  • feel free to link to this answer from http://stackoverflow.com/questions/41262284/nvidia-theano-docker-image-not-available and I'll share the points. – blue-sky Jan 05 '17 at 18:01
0

Have you tried the following?

pip3 install yourmodulename --trusted-host pypi.python.org
r0xette
  • 898
  • 3
  • 11
  • 24
  • tried that but received (I included '=' post --trusted-host) : Usage: pip install [options] ... pip install [options] -r ... pip install [options] [-e] ... pip install [options] [-e] ... pip install [options] ... no such option: --trusted-host – blue-sky Jan 05 '17 at 16:44
0

The problem is probably that you are behind a corporate proxy/firewall and outgoing connections are being blocked somewhere. A simple solution is just to change to the https version of the command:

Change:

pip3 install git+git://github.com/theano/theano.git@rel-${THEANO_VERSION}

To:

pip3 install git+https://github.com/theano/theano.git@rel-${THEANO_VERSION}

Alternatively:

You may want to try the steps here: https://help.github.com/articles/using-ssh-over-the-https-port/

This will redirect all git connections through the https protocol, which most companies allow :)

Good luck!

mimoralea
  • 9,590
  • 7
  • 58
  • 59