Kaixhin / dockerfiles

Compilation of Dockerfiles with automated builds enabled on the Docker Registry
https://hub.docker.com/u/kaixhin/
MIT License
505 stars 127 forks source link

Torch installs without itorch #10

Closed gforge closed 8 years ago

gforge commented 8 years ago

For some reason it seems that itorch isn't installed together with torch (I believe that it was installed in earlier versions):

max@max-UX31A:~/$ sudo docker run --rm -it -p 8888:8888 kaixhin/cuda-torch
Unable to find image 'kaixhin/cuda-torch:latest' locally
latest: Pulling from kaixhin/cuda-torch
bbe1c4256df3: Pull complete 
911d09728ffd: Pull complete 
615765bc0d9f: Pull complete 
a3ed95caeb02: Pull complete 
f6c40ea017da: Pull complete 
a53854637f3f: Pull complete 
1cd0c8506d8b: Pull complete 
687b23b1ba76: Pull complete 
73a547b0c44e: Pull complete 
964cc0d8070b: Pull complete 
c146c215733f: Pull complete 
d0ba2846eec7: Pull complete 
Digest: sha256:2e22615195b4ebb19bd633a9afca997e083625b70e457f2ad1a847f96aec7ad7
Status: Downloaded newer image for kaixhin/cuda-torch:latest
root@e80bdeb5c974:~/torch# ls
CMakeLists.txt  README.md  clean.sh  exe    install       install.sh  test.sh
LICENSE.md      build      cmake     extra  install-deps  pkg         update.sh
root@e80bdeb5c974:~/torch# itorch
bash: itorch: command not found

Since the jupyter notebook is one of the most natural ways for interacting with a docker container I believe that it would be beneficial to add itorch to the build or have separate builds that includes the itorch

Kaixhin commented 8 years ago

iTorch did use to be installed (as I remember someone asking me to fix a bug with it earlier). Not entirely sure what's changed, and unfortunately I don't use Jupyter notebooks so I'll need some help on this one. Do you have a solution? If so, then depending on how much extra is installed (i.e. the size of the Docker images), I'll either add it to kaixhin/torch or create kaixhin/itorch.

gforge commented 8 years ago

Here's an alternative to the torch\Dockerfile that seems to work. I've simply added pip and installed through it the jupyter notebook. It seems to get the right foundations for iTorch to be installed.

# Start with Ubuntu base image
FROM ubuntu:14.04
MAINTAINER Kai Arulkumaran <design@kaixhin.com>

# Install git, apt-add-repository and dependencies for iTorch
RUN apt-get update && apt-get install -y \
  git \
  software-properties-common \
  ipython3 \
  libssl-dev \
  libzmq3-dev \
  python-zmq \
  python-pip

RUN pip install notebook

# Run Torch7 installation scripts
RUN git clone https://github.com/torch/distro.git /root/torch --recursive && cd /root/torch && \
  bash install-deps > /dev/null && \
  ./install.sh

# Set ~/torch as working directory
WORKDIR /root/torch

# Export environment variables manually
ENV LUA_PATH='/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/root/torch/install/share/lua/5.1/?.lua;/root/torch/install/share/lua/5.1/?/init.lua;./?.lua;/root/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua'
ENV LUA_CPATH='/root/.luarocks/lib/lua/5.1/?.so;/root/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so'
ENV PATH=/root/torch/install/bin:$PATH
ENV LD_LIBRARY_PATH=/root/torch/install/lib:$LD_LIBRARY_PATH
ENV DYLD_LIBRARY_PATH=/root/torch/install/lib:$DYLD_LIBRARY_PATH
ENV LUA_CPATH='/root/torch/install/lib/?.so;'$LUA_CPATH

Also, in the docker hub you may want to hint that the image should be initiated with a port opened and the notebook with --ip='*', e.g.

> sudo docker run --name=tag -p 8888:8888 -it --rm kaixhin/iTorch
> jupyter notebook --ip="*" --no-browser

This will give you a notebook available at localhost:8888. As I've just started to explore Torch I'm not that familiar with all its features, looking at this there may be a few more additions worth considering although the iTorch docs indicate that this should suffice.

Kaixhin commented 8 years ago

Looks good to me. Updated the images and readmes - could you please check the latest build of kaixhin/torch that I just set up?

gforge commented 8 years ago

Works fine. I just realized that if you specify the IP to 0.0.0.0 the following warning disappears:

[W 12:58:14.645 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended. [W 12:58:14.646 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using authentication. This is highly insecure and not recommended.

I therefore suggest changing the instructions to:

"To use Jupyter/iTorch open up the appropriate port. For example, use docker run -it -p 8888:8888 kaixhin/torch. Then run jupyter notebook --ip="0.0.0.0" --no-browser to open a notebook on localhost:8888."

Another thing that may be worth considering is adding ipywidgets as this causes an unnecessary warning at start:

[W 12:56:40.753 NotebookApp] ipywidgets package not installed. Widgets are unavailable.

The addition necessary is:

RUN pip install ipywidgets

Thanks for the terrific work with these docker-files.

Kaixhin commented 8 years ago

Thanks for the update - think we can close this issue now :)