Installing theano 0.9 with GPU support on Ubuntu 14.04, TitanX pascal, Cuda8.0 - theano

It's driving me crazy. I'm following this guide to install the required libgpuarray. But I keep on getting errors.
In this guide:
cd <dir>
rm -rf build Build
mkdir Build
cd Build
cmake .. -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_BUILD_TYPE=Release
make
make install
DEVICE="<test device>" make test
cd ..
# Run the following export and add them in your ~/.bashrc file
export CPATH=$CPATH:~/.local/include
export LIBRARY_PATH=$LIBRARY_PATH:~/.local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.local/lib
python setup.py build
python setup.py install --user
cd
DEVICE="<test device>" python -c "import pygpu;pygpu.test()"
I'm supposed to reference my gpu in DEVICE="<test device>". However I tried everything here: gpu, gpu0, etc
but it still cannot find any GPU...
I get the following errors:
$python setup.py build
Traceback (most recent call last):
File "setup.py", line 15, in <module>
raise Exception('cython is too old or not installed '
Exception: cython is too old or not installed (at least 0.25 required)
which I just ignore since my pip is not able to install a lower version than the one that is globally installed, although I'm using virtualenv. And finally I get this error:
$DEVICE="gpu0" python -c "import pygpu;pygpu.test()"
ERROR: Failure: ValueError (Unknown device format:gpu)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/myUser/.local/lib/python2.7/site-packages/pygpu-0.6.5-py2.7-linux-x86_64.egg/pygpu/tests/test_tools.py", line 5, in <module>
from .support import (guard_devsup, rand, check_flags, check_meta, check_all,
File "/home/myUser/.local/lib/python2.7/site-packages/pygpu-0.6.5-py2.7-linux-x86_64.egg/pygpu/tests/support.py", line 32, in <module>
context = gpuarray.init(get_env_dev())
File "pygpu/gpuarray.pyx", line 634, in pygpu.gpuarray.init (pygpu/gpuarray.c:9407)
File "pygpu/gpuarray.pyx", line 583, in pygpu.gpuarray.pygpu_init (pygpu/gpuarray.c:9073)
ValueError: Unknown device format:gpu
----------------------------------------------------------------------
Ran 7 tests in 0.002s
FAILED (errors=7)
Edit:
Ok, so it compiles now when using "cuda0"
DEVICE="cuda0" python -c "import pygpu;pygpu.test()"
but still the computation seems to fail:
======================================================================
FAIL: pygpu.tests.test_blas.test_rgemmBatch_3d(16, 16, 9, 16, 'float32', ('f', 'f', 'c'), (False, False), False, 1, True, True, 0.6, 0.6)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/myUser/.local/lib/python2.7/site-packages/pygpu-0.6.5-py2.7-linux-x86_64.egg/pygpu/tests/support.py", line 39, in f
func(*args, **kwargs)
File "/home/myUser/.local/lib/python2.7/site-packages/pygpu-0.6.5-py2.7-linux-x86_64.egg/pygpu/tests/test_blas.py", line 225, in rgemmBatch_3d
numpy.testing.assert_allclose(cr, numpy.asarray(gr), rtol=1e-5)
File "/usr/local/lib/python2.7/dist-packages/numpy/testing/utils.py", line 1392, in assert_allclose
verbose=verbose, header=header)
File "/usr/local/lib/python2.7/dist-packages/numpy/testing/utils.py", line 739, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=1e-05, atol=0
(mismatch 99.9565972222%)
x: array([[[ 364.203369, 258.57843 , 282.774231, ..., 322.785706,
185.089233, 300.292389],
[ 203.502457, 226.207962, 202.701843, ..., 213.377808,...
y: array([[[ 239.617569, 217.584824, 167.131165, ..., 211.116486,
313.409271, 244.467926],
[ 248.086868, 237.813416, 164.860977, ..., 216.871902,...
----------------------------------------------------------------------
Ran 7292 tests in 177.637s
FAILED (failures=137)

Related

I'm getting errors in msdt-follina

So, i am using ubuntu and installed msdt-follina on it. I run command python3 follina.py -c "calc.exe". It worked. Now i ran python3 follina.py -r 9999, and it gives me error:
[+] copied staging doc /tmp/9oiqeh0y
Traceback (most recent call last):
File "/home/programersandco/msdt-follina/follina.py", line 166, in <module>
main(parser.parse_args())
File "/home/programersandco/msdt-follina/follina.py", line 104, in main
shutil.make_archive(args.output, "zip", doc_path)
File "/usr/lib/python3.10/shutil.py", line 1123, in make_archive
filename = func(base_name, base_dir, **kwargs)
File "/usr/lib/python3.10/shutil.py", line 1008, in _make_zipfile
zf.write(path, arcname)
File "/usr/lib/python3.10/zipfile.py", line 1773, in write
with open(filename, "rb") as src, self.open(zinfo, 'w') as dest:
OSError: [Errno 22] Invalid argument: '/tmp/9oiqeh0y/doc/word/_rels/document.xml.rels'
I tried with first command (python3 follina.py -c "calc.exe"), but it gives me the same error. Also i deleted whole folder and install it from github again, but nothing changed.

Can't install local python package

After few system upgrades I am no more able to install my Python 3 package. This is the output:
pab#pab:~/Mopiqtt-1.0.0 $ sudo pip3 install .
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pab/Mopiqtt-1.0.0
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/home/pab/Mopiqtt-1.0.0/setup.py", line 46, in <module>
'mqtt = mopiqtt:Extension',
File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 86, in setup
_install_setup_requires(attrs)
File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 75, in _install_setup_requires
dist = MinimalDistribution(attrs)
File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 57, in __init__
super().__init__(filtered)
File "/usr/local/lib/python3.7/dist-packages/setuptools/dist.py", line 475, in __init__
for ep in metadata.entry_points(group='distutils.setup_keywords'):
File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
return SelectableGroups.load(eps).select(**params)
File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
ordered = sorted(eps, key=by_group)
File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
dist.entry_points for dist in unique(distributions())
File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
k = key(element)
File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 931, in _normalized_name
return self._name_from_stem(stem) or super()._normalized_name
File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 600, in _normalized_name
return Prepared.normalize(self.name)
File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 855, in normalize
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
File "/usr/lib/python3.7/re.py", line 192, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I am struggling with this and can't find a solution. Relevant packages versions:
pip 22.1.1
setuptools 62.3.2
ez-setup 0.9
Thanks for any help.
[Edit}: Same problem if I run python3 setup.py check
I have fixed this by downgrading setuptools:
pip3 install --force-reinstall setuptools==40.8.0
but I don't have any idea of the bug....

Exception for pip upgrade

I am trying to upgrade pip and keep getting this message:
You are using pip version 10.0.1, however version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(base) name-MBP:~ name$ pip3 install --upgrade pip
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 244, in run
wheel_cache = WheelCache(options.cache_dir, options.format_control)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cache.py", line 186, in __init__
self._ephem_cache = EphemWheelCache(format_control)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cache.py", line 164, in __init__
self._temp_dir.create()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/temp_dir.py", line 73, in create
tempfile.mkdtemp(prefix="pip-{}-".format(self.kind))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tempfile.py", line 356, in mkdtemp
prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tempfile.py", line 126, in _sanitize_params
dir = gettempdir()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tempfile.py", line 294, in gettempdir
tempdir = _get_default_tempdir()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tempfile.py", line 229, in _get_default_tempdir
dirlist)
FileNotFoundError: [Errno 2] No usable temporary directory found in ['/var/folders/40/vdlxclg51vjf1q5y8ygtbb840000gn/T/', '/tmp', '/var/tmp', '/usr/tmp', '/Users/name']
Even when I am un/installing any thirty party packages (e.g. numpy) i am getting this exception.

Problem running Tensorflow (Ubuntu 19.10)

I've recently tried to install and run some python and tensorflow code from this repository.
I followed the manual installation procedure just as mentioned in the README.md present in the repository.
As I've never used tensorflow before, I had to install a lot of packages to get it up and running.
Currently, I've got tensorfow-gpu 1.13, python 3.7, and an Nvidia graphics card (mx250) on my Ubuntu 19.10 laptop, and I wish to get the code running. However, I'm having issues running the demo.sh file present with it.
Here's what I get in the err.txt when I run the command $ bash demo.sh > output.txt 2> err.txt at the cloned directory (after installing all required packages):
*** Aborted at 1575094215 (unix time) try "date -d #1575094215" if you are using GNU date ***
PC: # 0x7f92c7012ae8 ceres::internal::ProgramEvaluator<>::Evaluate()
*** SIGSEGV (#0x0) received by PID 22202 (TID 0x7f92acda5700) from PID 0; stack trace: ***
# 0x7f92c7452641 (unknown)
# 0x7f92c67dd540 (unknown)
# 0x7f92c7012ae8 ceres::internal::ProgramEvaluator<>::Evaluate()
# 0x7f92c709265f ceres::internal::TrustRegionMinimizer::EvaluateGradientAndJacobian()
# 0x7f92c7092f4a ceres::internal::TrustRegionMinimizer::IterationZero()
# 0x7f92c70972d4 ceres::internal::TrustRegionMinimizer::Minimize()
# 0x7f92c7088cbc ceres::Solver::Solve()
# 0x7f92c70899b9 ceres::Solve()
# 0x55bb3bb1a2eb colmap::BundleAdjuster::Solve()
# 0x55bb3bb78037 colmap::IncrementalMapper::AdjustGlobalBundle()
# 0x55bb3bac3f0c (unknown)
# 0x55bb3bac521d colmap::IncrementalMapperController::Reconstruct()
# 0x55bb3bac6a9b colmap::IncrementalMapperController::Run()
# 0x55bb3bbd7dfc colmap::Thread::RunFunc()
# 0x7f92c5ad9f74 (unknown)
# 0x7f92c67d1669 start_thread
# 0x7f92c578f323 clone
Traceback (most recent call last):
File "imgs2poses.py", line 11, in <module>
gen_poses(args.scenedir)
File "/home/abhigyan/Code/CVProject/LLFF/llff/poses/pose_utils.py", line 265, in gen_poses
run_colmap(basedir)
File "/home/abhigyan/Code/CVProject/LLFF/llff/poses/colmap_wrapper.py", line 70, in run_colmap
map_output = ( subprocess.check_output(mapper_args, universal_newlines=True) )
File "/home/abhigyan/anaconda3/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/home/abhigyan/anaconda3/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['colmap', 'mapper', '--database_path', 'data/testscene/database.db', '--image_path', 'data/testscene/images', '--output_path', 'data/testscene/sparse', '--Mapper.num_threads', '16', '--Mapper.init_min_tri_angle', '4', '--Mapper.multiple_models', '0', '--Mapper.extract_colors', '0']' died with <Signals.SIGSEGV: 11>.
Traceback (most recent call last):
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "imgs2mpis.py", line 10, in <module>
from llff.inference.mpi_utils import run_inference
File "/home/abhigyan/Code/CVProject/LLFF/llff/inference/mpi_utils.py", line 6, in <module>
from llff.inference.mpi_tester import DeepIBR
File "/home/abhigyan/Code/CVProject/LLFF/llff/inference/mpi_tester.py", line 1, in <module>
import tensorflow as tf
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
mkdir: cannot create directory ‘data/testscene/outputs/’: File exists
Traceback (most recent call last):
File "imgs2renderpath.py", line 34, in <module>
poses, bds = load_data(args.scenedir, load_imgs=False)
File "/home/abhigyan/Code/CVProject/LLFF/llff/poses/pose_utils.py", line 195, in load_data
poses_arr = np.load(os.path.join(basedir, 'poses_bounds.npy'))
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/numpy/lib/npyio.py", line 428, in load
fid = open(os_fspath(file), "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'data/testscene/poses_bounds.npy'
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
demo.sh: line 24: 22221 Aborted (core dumped) cuda_renderer/cuda_renderer data/testscene/mpis_360 data/testscene/outputs/test_path.txt data/testscene/outputs/test_vid.mp4 360 .8 18
When you are going to use Tensorflow in GPU setup, have to carefully install and configure the Tensorflow in your machine. I would like to prefer to use Ubuntu 18.04 LTS version instead of 19.xx.
Follow the installation steps from the blog: https://zhuanlan.zhihu.com/p/49166211

Tensorflow 1.5 on Raspberry Pi3

I followed these instructions to compile tensorflow:
https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md
I pulled the newest bazel (0.9.0)from github and compiled it successfully. After that I pulled the newest tensorflow (1.5.0) from github then applied this command
grep -Rl 'lib64' | xargs sed -i 's/lib64/lib/g'
I skipped the editing of tensorflow/workspace.bzl. Then I ran the configuration script and provided the paths for python 3.5. Compilation was after one night successful with following command from tutorial:
bazel build -c opt --copt="-mfpu=neon-vfpv4" --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package
Then I builded the package:
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Then the installation in python also worked without errors:
sudo pip3 install /tmp/tensorflow_pkg/tensorflow-1.5.0rc1-cp35-cp35m-linux_armv7l.whl --upgrade --force-reinstall
But then when I start python3 from my home directory and try to import tensorflow with: import tensorflow as tf following error appears:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
How can I fix this? Thank you in advance!
It is looking for ConcatCPU defined here:
https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/core/kernels/concat_lib_cpu.cc#L51
undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
So there may be something wrong with your bazelrc.
You have multiple options:
1) Dig in your bazelrc and check that concat_lib_cpu.cc is being compiled, check that the linker sees it, etc.
2) RECOMMENDED - Simply download the package from ci.tensorflow.org and install:
Python 3: http://ci.tensorflow.org/view/Nightly/job/nightly-pi-python3/lastSuccessfulBuild/
Python 2: http://ci.tensorflow.org/view/Nightly/job/nightly-pi/lastSuccessfulBuild/
3) Use Tensorflow Lite if you can, remember RPIs are limitted.
Good luck.

Resources