The above did not work for me. So I created an install script following instructions on OpenCV website
make a directory called /tf_files/opencv_install. Then change the directory to that.
Create the below bash shell script. Then execute the script.
#install_opencv_mine.sh
=========================
git clone https://github.com/Itseez/opencv.git
git clone https://github.com/Itseez/opencv_contrib.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j7 # runs 7 jobs in parallel
make install
After this install the python opencv bindings
apt-get install -y python-opencv
If the web browser does not connect to jupyter session, make sure that the EC2 instance has the correct 'security group' with the ports opened up.
security group example (at least these ports should be opened up): launch-wizard-3
===================================================================================
Custom TCP Rule
TCP
8888
0.0.0.0/0
Custom TCP Rule
TCP
8888
::/0
Custom TCP Rule
TCP
6006
0.0.0.0/0
Custom TCP Rule
TCP
6006
::/0
SSH
TCP
22
0.0.0.0/0
HTTPS
TCP
443
0.0.0.0/0
HTTPS
TCP
443
::/0
STOP INSTANCE, RESTART INSTANCE, START DOCKER and then RE_RUN jupyter
When the GPU instance is stopped and then restarted, it assigns a new public DNS.
So the previous way of connecting to AWS EC2 instance won't work. Just change the DNS name in the 'ssh command'
Everything else remains the same. All files, docker stays intact. If we do the following we will see that everything is the same
sudo su
cd /home/ubuntu/workdir/tensorflow/tensorflow/tools/docker
docker images -a
docker ps -a # will show that the previous docker process has exited. Copy the container id from here
# NOW JUST START THE DOCKER CONTAINER AND THEN START jupyter
docker start <CONTAINER ID> # for example: f5e826b541b4
docker attach <CONTAINER ID> # for example: f5e826b541b4
cd /
nohup ./run_jupyter.sh --allow-root > tf_files/nohup.out 2>&1 < /dev/null &
To start another docker shell using the same container id, but avoiding clash with co-user
docker exec -it f5e8 bash
This will open another bash shell in the same container
# To start jupyter inside docker from an xterm (say own Mac) and then
# silently exiting without breaking docker
> cd /
> nohup ./run_jupyter.sh --allow-root > tf_files/nohup.out 2>&1 < /dev/null &
> CTRL P Q