This should work (I'm not sure if there's a better way though); you need to build the tree using a point cloud if you want to use compute_closest_point
:
import numpy as np
import dolfin
p = dolfin.Point( np.random.rand(3) )
mesh = dolfin.UnitCubeMesh(10,10,10)
tree = mesh.bounding_box_tree()
point_cloud = [dolfin.Point(point) for point in mesh.coordinates()]
tree.build(point_cloud, 3)
p_i, distance = tree.compute_closest_point(p)
print "p:", p.str()
print "closest point:", point_cloud[p_i].str()
As an alternative, you can probably use the method compute_first_entity_collision
to get the index of the closest cell in the mesh, and use that cell to compute the point.