Not able to fetch any RDD records using .first() or .take commands

Not able to fetch any RDD records using .first() or .take commands.

The sc context is getting created successfully.

But after that when I try to see the first record or first 10 records…it gives the error given below.
I am using these commands in sequence:
$ pyspark --master yarn --conf spark.ui.port=10001

orderItems = sc.textFile("/public/retail_db/order_items")
orderItems.first()
Got error

for i in orderItems.take(10): print(i)
Got error

Hi @SG_P,

please try to use SPARK 2 . spark 1.x is outdated now so it’s better to practice on spark2.

To launch pyspark2 use below command-

pyspark2 --master yarn --conf spark.ui.port=0

To create RDD-
orderItems = sc.textFile("/public/retail_db/order_items")

orderItems.first()
for i in orderItems.take(10): print(i)