Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 2?

I am trying to execute NLTK in Hadoop environment. Following is the command which i used for execution.

bin/hadoop jar $HADOOP_HOME/contrib/streaming/hadoop-streaming-1.0.4.jar -input /user/nltk/input/ -output /user/nltk/output1/ -file /home/hduser/softwares/NLTK/unsupervised_sentiment-master.zip -mapper /home/hduser/softwares/NLTK/unsupervised_sentiment-master/sentiment.py

unsupervised_sentiment-master.zip --- contains all the dependent files required for sentiment.py

I am getting

java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 2
    at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:362)
    at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:576)
    at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:135)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
    at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:436)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
    at org.apache.hadoop.mapred.Child.main(Child.java:249)

Any help would be greatly appreciated!!!

like image 527
Praveen Gr Avatar asked May 06 '13 11:05

Praveen Gr


4 Answers

Could you pls post the python files? My guess is that, you need to add #!/usr/bin/python to the top of your py file. This was the case when I was streaming using python.

like image 147
quiet_penguin Avatar answered Nov 06 '22 21:11

quiet_penguin


Adding below line to the top of python script made the code work for me.

#!/usr/bin/python

like image 27
user3886907 Avatar answered Nov 06 '22 20:11

user3886907


In your sentiment.py file, add the following line to the top:

```

!/usr/bin/env python

```

This worked for me.

like image 2
Alex Hamburgers Avatar answered Nov 06 '22 21:11

Alex Hamburgers


I can't say exactly what your error is, but mine was that I had an unresolved dependency in my python script. Namely statsmodels.

like image 1
Brian Dolan Avatar answered Nov 06 '22 21:11

Brian Dolan