view raw
NmdMystery NmdMystery - 6 months ago 47
Python Question

Spark/Hadoop can't find file on AWS EMR

I'm trying to read in a text file on Amazon EMR using the python spark libraries. The file is in the home directory (/home/hadoop/wet0), but spark can't seem to find it.

Line in question:

lines =[1]) r: r[0])


pyspark.sql.utils.AnalysisException: u'Path does not exist: hdfs://;'

Does the file have to be in a specific directory? I can't find information about this anywhere on the AWS website.


If its in the local filesystem, the URL should be file://user/hadoop/wet0 If its in HDFS, that should be a valid path. Use the hadoop fs command to take a look

e.g: hadoop fs -ls /home/hadoop

one think to look at, you say it's in "/home/hadoop", but the path in the error is "/user/hadoop". Make sure you aren't using ~ in the command line, as bash will do the expansion before spark sees it. Best to use the full path /home/hadoop