Installing Tensorflow in Anaconda on macOS

The Tensorflow website has good installation instructions for the MAC OS X environment. The official installation instructions for MacOS are provided at https://www.tensorflow.org/install/install_mac. Included are instructions for virtualenv, a native pip environment, using a Docker container, Anaconda command line, and installing from sources. Although straightforward, it doesn’t include installing in an Anaconda Navigator application environment.

Anaconda is a free, open source, community supported development environment for Python and R. Anaconda manages libraries and configurable environments. It’s also a good place to experiment with scientific and machine intelligence packages. The growingly more useful Tensorflow libraries can be used to experiment within an Anacondo environment.

Anaconda Navigator is a desktop graphical user interface included in Anaconda. Packages, environments, and channels are easy to manage with this GUI. Anaconda can be installed by following the instructions at the Anaconda download site. After installation, it’s best to make sure the latest versions are installed. To quickly update using a command line interface:

$ conda update anaconda anaconda-navigator

Then, launch the Anaconda-Navigator application.

In the Navigator application, select the Environments menu item in the far left column. By default, there is one Root environment. Multiple environments with different configurations can be set up here over time. It’s typically best to upgrade existing packages to current versions. The latest version of Python should be installed (3.6 at the time of this writing) should be used.

  1. Select the Environments menu item in the left column.
  2. Select the Environment to update (in this case Root).
  3. Select Upgradable from the drop-down menu.
  4. Select the version number in the Version column to define packages to upgrade. Make sure Python is the most recent version.
  5. Select Apply.

 

To install the Tensorflow packages, a new and clean environment can be created. It will contain the base packages necessary, the latest version of Python and Tensorflow will be installed.

  1. Select the Create button at the bottom of the Environments column.
  2. In the popup menu, type ‘Tensorflow’ in the Name text entry field.
  3. Select the Python checkbox.
  4. Select version 3.6 in the drop-down menu.
  5. Select Create.

tensorflow-environment

Tensorflow packages can now be installed into the new environment.

  1. Select ‘Not Installed’ from the drop-down menu at the top of the right window pane.
  2. Type ‘tensorflow’ in the Search Packages text input field and hit Return.
  3. Select the checkbox in the left column next to the two tensorflow package names.
  4. Click Apply.

tensorflow-install

To validate the installation, using the newly created Tensorflow environment:

  1. Make sure the Tensorflow environment is selected.
  2. Select the arrow next to the Tensorflow environment name.
  3. Select ‘Open with IPython’.
  4. A terminal window with the environment settings created will pop up.
  5. As recommended on the Tensorflow website, type the following into the terminal window
    import tensorflow as tf
    hello = tf.constant('Hello, TensorFlow!')
    sess = tf.Session()
    print(sess.run(hello))

Assuming there are no errors, the newly installed and configured environment is ready for developing with tensorflow.

Advertisements

Do Not Be Afraid of Technology

Since the 1920’s, with the beginning of referencing intelligent robots, we have been afraid of robots, replicants or androids taking control over humans. Today, many people are afraid of terminators being created, hell-bent on eliminating the human scourge or an intelligent overlord ruling us in a virtual matrix. But since the human’s number one imperative is to survive and procreate, we should be thinking of robots, AI and technology, in general, as a way to ensure our survival, not to destroy it.

Destroying technology helps ensure our demise rather than saving us. Even being afraid of it largely due to ignorance or misunderstanding is dangerous to survival. Brutal as humans can be with evil or self-serving intent, technology has largely enhanced our well-being.  Our food sources have increased. Distribution of goods and services has become more efficient. Disease has been vastly reduced worldwide. Our understanding, modeling, and prediction of our complex surroundings have become more sophisticated and accurate. All through the advancement and application of technology.

The unfounded paranoia about technology and AI being evil is a misunderstanding with an incomplete set of facts. It is a lack of education, the pronouncement of incorrect ideas and a lack of adequately correcting falsehoods. If the majority of people are led to be afraid, they likely will try to destroy what can potentially ensure their existence. If they are educated or provided the tools to acquire a rounded understanding of technology’s benefits, the human species may have a chance to survive for quite some time.