We'll cover the basics of Docker and containerization, how to install Docker,. Similar to virtual machines, systems built on different technologies (e.g. Enter the command below: docker run jupyter/minimal-notebook Using this. So, when you install tensorflow on the container, it is only installed for that. How to run Tensorboard and jupyter concurrently with docker? Ask Question. I also followed the instructions in Nvidia Docker, Jupyter Notebook and Tensorflow GPU. Docker volume create -name notebooks docker volume create -name logs.
It should have been named 'Jupyter for Deep Learning, Natural Language Processing and common Data Mining'.
Dockerized version of Jupyter with installed Keras, TensorFlow, Theano, Sklearn, NLTK, Gensim, Pandas, etc.
Versions:
First, install nvidia-docker: https://github.com/NVIDIA/nvidia-docker
Then, run the container:
Or, with full options and authentication (for copy-paste convenience :)): Mac webcam driver for your screen.
You may want to add something like --shm-size=1024m to the commands above, because sklearn.grid_search.GridSearchCV may fail if you train large models.
This by default enables all the devices.
After that, jupyter notebook will be available at http://:8888/.
Or, with full options and authentication (for copy-paste convenience :)):
You may want to run this container on a server which is accessible via Internet. To protect it, you'd better provide a password and SSL certificate and key.
Use openssl to generate a self-signed certificate. If you always forget how to do this (like I do), you can use a simple utility: https://github.com/windj007/ssl-utils
Jupyter does not store plain password. It uses a hashed version instead. To make a hashed version of you password, please run:
You have to pass the hashed password and tell jupyter to enable SSL and mount a volume with your cert and key. A sample command to run protected notebook (cuda-related options ommitted for conciseness):
After that, you will have to access Jupyter with explicit https:// in address (Jupyter does not have automatic redirect, AFAIK, maybe I'm wrong).
In this tutorial, we will explain how to install TensorFlow with Anaconda. You will learn how to use TensorFlow with Jupyter. Jupyter is a notebook viewer.
TensorFlow supports computations across multiple CPUs and GPUs. It means that the computations can be distributed across devices to improve the speed of the training. With parallelization, you don't need to wait for weeks to obtain the results of training algorithms.
For Windows user, TensorFlow provides two versions:
During this tutorial, the basic version of TensorFlow is sufficient.
Note: TensorFlow does not provides GPU support on MacOS.
Here is how to proceed
MacOS User:
For Windows
To run Tensorflow with Jupyter, you need to create an environment within Anaconda. It means you will install Ipython, Jupyter, and TensorFlow in an appropriate folder inside our machine. On top of this, you will add one essential library for data science: 'Pandas'. The Pandas library helps to manipulate a data frame.
Download Anaconda version 4.3.1 (for Python 3.6) for the appropriate system.
Anaconda will help you to manage all the libraries required either for Python or R. Refer this tutorial to install Anaconda
It includes
Step 1) Locate Anaconda
The first step you need to do is to locate the path of Anaconda. You will create a new conda environment that includes the necessaries libraries you will use during the tutorials about TensorFlow.
Windows
If you are a Windows user, you can use Anaconda Prompt and type:
We are interested to know the name of the folder where Anaconda is installed because we want to create our new environment inside this path. For instance, in the picture above, Anaconda is installed in the Admin folder. For you, it can the same, i.e. Admin or the user's name.
In the next, we will set the working directory from c: to Anaconda3.
MacOS
for MacOS user, you can use the Terminal and type:
You will need to create a new folder inside Anaconda which will contains Ipython, Jupyter and TensorFlow. A quick way to install libraries and software is to write a yml file.
Step 2) Set working directory
You need to specify the working directory where you want to create the yml file. As said before, it will be located inside Anaconda.
For MacOS user:
The Terminal sets the default working directory to Users/USERNAME. As you can see in the figure below, the path of anaconda3 and the working directory are identical. In MacOS, the latest folder is shown before the $. The Terminal will install all the libraries in this working directory.
If the path on the text editor does not match the working directory, you can change it by writing cd PATH in the Terminal. PATH is the path you pasted in the text editor. Don't forget to wrap the PATH with 'PATH'. This action will change the working directory to PATH.
Open your Terminal, and type:
For Windows user (make sure of the folder before Anaconda3):
or the path 'where anaconda' command gives you
Step 3) Create the yml file
You can create the yml file inside the new working directory. The file will install the dependencies you need to run TensorFlow. Copy and paste this code into the Terminal.
For MacOS user:
A new file named hello-tf.yml should appear inside anaconda3
For Windows user:
A new file named hello-tf.yml should appear
Step 4) Edit the yml file
For MacOS user:
You are ready to edit the yml file. You can paste the following code in the Terminal to edit the file. MacOS user can use vim to edit the yml file.
So far, your Terminal looks like this
You enter an edit mode. Inside this mode, you can, after pressing esc:
Write the following code in the edit mode and press esc followed by :w
Note: The file is case and intend sensitive. 2 spaces are required after each intend.
For MacOS Code Explanation
Press esc followed by :q! to quite the edit mode.
For Windows User:
For the most revealing results, we threw Peacekeeper's HTML5 torture test at each, pitting Waterfox against the site's Chrome benchmark and our own copy of Chrome.This online benchmarking tool separates the smartphones from the gaming desktops with a series of increasingly grueling tests that took some 5 minutes to run through. Waterfox bested Firefox but not Chrome, both in speed and HTML5-rendering capability, though the results were close enough to make it a matter of choice. Waterfox also has regular updates.We could tell with just a few quick trips to familiar sites that Waterfox is fast, so we visited some of our favorite browser speed test sites to see how it stacks up against the competition, including Firefox and our current default, Chrome. Waterfox 56.2.4 download for mac.
Windows does not have vim program, so the Notepad is enough to complete this step.
Enter following into the file
Code Explanation
It will open the notepad, you can edit the file from here.
Note: Windows users will install TensorFlow in the next step. In this step, you only prepare the conda environment
Step 5) Compile the yml file
You can compile the .yml file with the following code :
Note: For Windows users, the new environment is created inside the current user directory.
It takes times. It will take around 1.1gb of space in your hard disk.
In Windows
Step 6) Activate conda environment
We are almost done. You have now 2 conda environments. You created an isolated conda environment with the libraries you will use during the tutorials. This is a recommended practice because each machine learning project requires different libraries. When the project is over, you can remove or not this environment.
The asterix indicates the default one. You need to switch to hello-tf to activate the environment
For MacOS user:
For Windows user:
You can check all dependencies are in the same environment. This is important because it allows Python to use Jupyter and TensorFlow from the same environment. If you don't see the three of them located in the same folder, you need to start all over again.
For MacOS user:
Optional: You can check for update.
Step 7) For Windows user only: Install TensorFlow
For windows user:
As you can see, you now have two Python environments. The main one and the newly created on i.e. hello-tf. The main conda environment does not have tensorFlow installed only hello-tf. From the picture, python, jupyter and ipython are installed in the same environment. It means, you can use TensorFlow with a Jupyter Notebook.
You need to install Tensorflow with the following command. Only for Windows user
This part is the same for both OS.
You can open TensorFlow with Jupyter.
Note: Each time you want to open TensorFlow, you need to initialize the environment
You will proceed as follow:
Step 1) Activate conda
For MacOS user:
For Windows user:
Step 2) Open Jupyter
After that, you can open Jupyter from the Terminal
Your browser should open automatically, otherwise copy and paste the url provided by the Terminal. It starts by http://localhost:8888
Inside the Jupyter Notebook, you can see all the files inside the working directory. To create a new Notebook, you simply click on new and Python 3
Note: The new notebook is automatically saved inside the working directory.
Step 3) Import Tensorflow
Inside the notebook, you can import TensorFlow with the tf alias. Click to run. A new cell is created below.
Let's write your first code with TensorFlow.
A new tensor is created. Congratulation. You successfully install TensorFlow with Jupyter on your Machine.
Step 4) Delete file
You can delete the file named Untitled.ipynb inside Jupyer.
Step 5) Close Jupyter
There are two ways of closing Jupyter. The first way is directly from the notebook. The second way is by using the terminal (or Anaconda Prompt)
From Jupyter
In the main panel of Jupyter Notebook, simply click on Logout
You are redirected to the log out page.
From the terminal
Select the terminal or Anaconda prompt and run twice ctr+c.
The first time you do ctr+c, you are asked to confirm you want to shut down the notebook. Repeat ctr+c to confirm
You have successfully logged out.
If you want to launch TensorFlow with jupyter for future use, you need to open a new session with
If you don't, Jupyter will not find TensorFlow