Now, I got the problem. Pig uses Jython and JRuby libraries for compiling python and ruby udfs. So it doesn't make any difference if we install additional module in the slave nodes separately. The preferable way is to use pig streaming features in these kind of scenarios.