Installed, via pip, the python bindings for tensorflow (for CPU, not GPU/CUDA)
sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
This did a bunch of things, including uninstalling numpy 1.6 (from disutils?) and re-installing numpy (via pip?). Hope that doesn't break shit. Probably should have done this in a virtualenv... While this did install fine, I can't import it because it used a binary that derives from a version of glibc that is newer than the one I have installed. I'd rather not upgrade glibc, so I'll try to compile myself. Including error below so Google can find it.
>>> import tensorflow ... _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.17' not found (required by /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow.so)
So, now I'm faced with two options: Upgrade my glibc to 2.17 just for tensorflow, or rebuild from source so that my build of tensorflow is linked to my installed version of glibc (2.15). I'm choosing to build from source, which doesn't look too bad.
Building from source
Going to try to keep it simple (no GPU support). Following instructions from the docs
Clone the tensorflow and bazel repositories.
$ git clone --recurse-submodules https://github.com/tensorflow/tensorflow $ git clone https://github.com/bazelbuild/bazel.git
To get Bazel built, I had to install java 8. This is my guess at least, because compiling with Java 7 gives the following error:
java.lang.AssertionError: java.lang.NullPointerException at com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue(Symbol.java:1005)
Let's install Java 8 first (probably should do this anyway for other projects):
$ sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update $ sudo apt-get install oracle-java8-installer $ sudo update-alternatives --config java ... selected java 8 from the menu, now system java points to java 8 $ java -version java version "1.8.0_66"
Compile bazel -- with JAVA_HOME updated to point to jdk 8
$ cd bazel $ JAVA_HOME=/usr/lib/jvm/java-8-oracle/ ./compile.sh
Turns out there's a bug for debian wheezy that causes the build to fail.
location R_X86_64_PC32 against symbol `PostException(JNIEnv_*, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value
There's a fix, which involves removing the -fPIC flags from the compiler. I commented out line 162, 275, 383 in tools/cpp/CROSSTOOL. This did not work in the end, so I tried checking out a previous 1.0 version via git (based on the previously mentioned github issue):
git checkout ecd4ec
Now, building appears to work:
$ JAVA_HOME=/usr/lib/jvm/java-8-oracle/ ./compile.sh $ ./output/bazel --help (this runs fine)
Now, let's build tensorflow
$ cd tensorflow $ ../bazel/output/bazel build
... this won't build due to an error
Turns out I can just intall Bazel 0.1.0 -- oops.