Here we will be setting up Anaconda Navigator to install Python, Keras, and Tensorflow. Navigator just manages your AI programs such as Keras, and Tensorflow.
2.1 Open the terminal with Ctrl-Alt-t.
2.2 Enter the following to open Anaconda-Navigator GUI. If you are not in the base environment, type conda activate
steve@steve:~$ conda activate
(base) steve@steve:~$ anaconda-navigator
2.3 If you want to leave the base environment, type conda deactivate. But you will exit Anaconda-Navigator. You must be in the base enviroment for the command anaconda-navigator to work.
(base) steve@steve:~$ conda deactivate
steve@steve:~$
2.4 After launching Anaconda Navigator, go to the Environments tab and click on the Create icon.
2.5 Input the environment name, using the version of Python. Our name for the environment is env2.
2.6 Click Create.
2.7 Now it is time to add tensorflow and keras to the environment. Install tensorflow first. Select ‘Not installed’ and type tensorflow in the box. Update the index. Select tensorflow from the index and click Apply. A pop-up window will appear; click Apply. Another pop-up window will ask to update your version of Anaconda. Click no.
2.8 Repeat 2.7 for keras.
Time to test the installation using Method 1. Click on arrow to right of env2 in Anaconda Navigator. Select Open Terminal. If the terminal does not open, go to Method 2.
2.10 At command line install the import command using the following command.
(env2) steve@steve:~$ sudo apt install graphicsmagick-imagemagick-compat
2.11 At command line type python.
(env2) steve@steve:~$ python
2.12 The command prompt will change to the following.
>>>
2.13 Type import tensorflow as tf and press enter. If there are no errors, everything is working properly.
>>> import tensorflow as tf
2.14 Type import keras and press enter. If there are no errors, everything is working properly.
>>> import keras
2.15 Type exit(). The prompt will change back.
(env2) steve@steve:~$
2.16 We can do one more optional test. We will print out the keras version. (Use double underscores around version.)
(env2) steve@steve:~$ python -c “import keras; print(keras.__version__)”
Output
2.4.3
2.17 If you want to exit the environment and Anaconda Navigator, type conda deactivate. For advanced users skip to Chapter 4 for a basic neural network program. For intermediate users go to Chapter 3 to review use of the Nano text editor.
(env2) steve@steve:~$ conda deactivate
Output
(base) steve@steve:~$
If Method 1 does not work, test using Method 2. Click on arrow to right of env2 in Anaconda Navigator. Select Open Terminal. If the terminal does not open, use Ctrl-Alt-t to open a terminal.
2.19 If not in base use conda activate
steve@steve:~$ conda activate
Output
(base)steve@steve:~$
2.20 Switch to env2.
(base)steve@steve:~$ conda activate env2
Output
(env2) steve@steve:~$
2.21 At command line type python.
(env2) steve@steve:~$ python
2.22 The command prompt will change to the following.
>>>
2.23 Type import tensorflow as tf and press enter. If there are no errors, everything is working properly.
>>> import tensorflow as tf
2.24 Type import keras and press enter. If there are no errors, everything is working properly.
>>> import keras
2.25 Type exit(). The prompt will change back.
(env2) steve@steve:~$
2.26 One more optional test. We will print out the keras version. (Use double underscores around version.)
(env2) steve@steve:~$ python -c “import keras; print(keras.__version__)”
Output
2.4.3
2.27 If you want to exit the environment and Anaconda Navigator, type conda deactivate. For advanced users skip to Chapter 4 for a basic neural network program. For intermediate users go to Chapter 3 to review use of the Nano text editor.
(env2) steve@steve:~$ conda deactivate
Output
(base) steve@steve:~$
Table of Contents
Ch1-Installation
Ch2-Conda Navigator
Ch3-Nano Editor
Ch4-Run a Program
Ch5-Program Explained