title: How can I use tensorflow read/write files from hdfs?
body: <p>I want to use tensorflow to write and read files from hdfs.I used 'pip install ten……' to install tensorflow.And when I read file from hdfs,it's does work,just stop at there and no error reply.
  Do I need to install tensorflow by ./configure and than bazel build?Is it must install like this way it can support hdfs?</p>
  
  <p>here is my code write file to local file system:</p>
  
  <pre><code>with tf.Session(graph=graph,config=config) as sess:
      sess.run(init)
      summary_writer = tf.summary.FileWriter('./mnist_logs2/', graph_def=sess.graph_def)
      for i in range(2000000):
          batch=mnist.train.next_batch(10000)
          train_step.run(feed_dict={x:batch[0],y_:batch[1],keep_prob:0.8})
  
          if i%100==0:
              acc_test=sess.run(accuracy,feed_dict={x:mnist.test.images,y_:mnist.test.labels,keep_prob:1.0})
              print("step %d,test accuracy %g"%(i,acc_test))
              if acc_test&gt;0.993:
                  break
  
      saver_path=saver.save(sess,'/home/test/mnist/model.ckpt')
  
      print("test accuracy %g"%accuracy.eval(feed_dict={x:mnist.test.images,y_:mnist.test.labels,keep_prob:1.0}))
  </code></pre>
  
  <p>here is my code I write file to hdfs,only change the path:</p>
  
  <pre><code>with tf.Session(graph=graph,config=config) as sess:
      sess.run(init)
      summary_writer = tf.summary.FileWriter('hdfs://user/mlp/zpc/mnist_logs2/', graph_def=sess.graph_def)
      for i in range(2000000):
          batch=mnist.train.next_batch(10000)
          train_step.run(feed_dict={x:batch[0],y_:batch[1],keep_prob:0.8})
  
          if i%100==0:
              acc_test=sess.run(accuracy,feed_dict={x:mnist.test.images,y_:mnist.test.labels,keep_prob:1.0})
              print("step %d,test accuracy %g"%(i,acc_test))
              if acc_test&gt;0.993:
                  break
  
      saver_path=saver.save(sess,'hdfs://user/mlp/zpc/mnist_logs2/model.ckpt')
  
      print("test accuracy %g"%accuracy.eval(feed_dict={x:mnist.test.images,y_:mnist.test.labels,keep_prob:1.0}))
  </code></pre>
  
  <p>when I run the code which write to hdfs, I run like below:</p>
  
  <pre><code>CLASSPATH=$($HADOOP_HDFS_HOME/bin/hadoop classpath --glob) python mnist_linux.py
  </code></pre>