Install TensorFow with VirtualEnv, not from binary and sources (if you are a Mac user)
According to Getting Started/Download and Setup, there are four ways to install TensorFlow: (1) installing from binary, (2) installation from source, (3) installing with VirtualEnv, and (4) installing with Docker. I tried (1)~(3) and found (3) is the best at the moment unlike typical open source software installation process. So I suggest you to install with VirtualEnv and play around with TensorFlow in order to gain some experience. Meanwhile we can save time until Google fixes the problems (to run some tutorial files).
The summary of my experience to install TensorFlow on Mac OS X (El Capitan ver.10.11.1) is below.
Binary Source VirtualEnv Docker
Time Spent ~1 hr hours ~1 hr –
Installation Easy hard Easy –
First Program O – O –
First Tutorial Example X – X –
The symbol “-” means I didn’t try.
In the first tutorial example, “$ python fully_connected_feed.py” spit an error.
Fixing errors in the first tutorial example
“$ python fully_connected_feed.py” spit errors due to the following two lines. In fully_connected_feed.py,
from tensorflow.g3doc.tutorials.mnist import input_data
from tensorflow.g3doc.tutorials.mnist import mnist
Fix the errors as follows.
#from tensorflow.g3doc.tutorials.mnist import input_data
#from tensorflow.g3doc.tutorials.mnist import mnist
What the above changes does is to import Python source codes input_data.py and moist.py from the local directory, not from “tensorflow.g3doc.tutorials.mnist.”
The verbose version of my experience to install TensorFlow
When it comes to installation of a new open source software, I install from the binary file, gain some experience with the software, and then install from source codes. As TensorFlow is an open source software, I followed this habit.
Initially, I installed TensorFlow from binary (without much struggle) and verified if the installation went well. The first TensorFlow program ran successfully. But the first tutorial example, the MNIST example on TensorFlow Mechanics 101, needs to be fixed because the example spit an error message.
To fix this problem, I’ve changed the Python code which gave a serious of problems. I fixed several problems, but thought this is not how the binary installation should work assuming the tutorial is correct. Conversely, the installation may be correct and the tutorial may be wrong.
As a newbie to TensorFlow, it is hard to judge if the tutorial is wrong. So I decided to return to the installation process. Installing from source is more tedious than I expected. The TensorFlow installation document Getting Started/Download and Setup (for the Mac part) is not a cook book manual. It points to the packages that need to be installed. Anyways I installed all the required packages, but something seemed not right.
In the meantime, I found this sentences on Download and Setup.
If you encounter installation errors, see common problems for some solutions. To simplify installation, please consider using our virtualenv-based instructions here.
I tried VirtualEnv. The installation went smooth and I figured the tutorial was wrong. So I suggest you trying to install with VirtualEnv until you gain some experience with TensorFlow. The installation was simplified, indeed.