python - No module named py4j.protocol on Eclipse (PyDev) -
i configured eclipse in order develop spark , python. configured : 1. pydev python interpreter 2. pydev spark python sources 3. pydev spark environment variables.
this libraries configuration :
and environment configuration :
i created project named compensationstudy , want run small example , sure go smoothly.
this code :
from pyspark import sparkconf, sparkcontext import os sparkconf = sparkconf().setappname("wordcounts").setmaster("local") sc = sparkcontext(conf = sparkconf) textfile = sc.textfile(os.environ["spark_home"] + "/readme.md") wordcounts = textfile.flatmap(lambda line: line.split()).map(lambda word: (word, 1)).reducebykey(lambda a, b: a+b) wc in wordcounts.collect(): print wc
but got error : importerror: no module named py4j.protocol
logicly, of pyspark’s library dependencies, including py4j, automatically imported when configure pydev spark python sources.. so, what's wrong here ? there problem log4j.properties file ? please !
are able run command line? think first step taking ide out of question, so, try running proper environment variables in command line (maybe asking pyspark community), after that's running, try comparing env variables have in run run in command line (create program runs env variables , run in console , in ide check difference).
one note (which not issue, still...): screenshot, seems project configuration has /compensationstudy
added pythonpath, yet, seem putting code in /compensationstudy/src
(so, should edit project configuration put /compensationstudy/src
in pythonpath).
Comments
Post a Comment