Unable to run spark code via pycharm

/Users/r/PycharmProjects/Spark/venv/bin/python

/Users/r/PycharmProjects/Spark/Spark.py
19/12/02 21:46:48 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable
Using Spark’s default log4j profile: org/apache/spark/log4j-defaults.properties
Setting default log level to “WARN”.
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
19/12/02 21:46:48 WARN Utils: Service ‘SparkUI’ could not bind on port 4040. Attempting port 4041.
19/12/02 21:46:48 WARN Utils: Service ‘SparkUI’ could not bind on port 4041. Attempting port 4042.
19/12/02 21:46:48 WARN Utils: Service ‘SparkUI’ could not bind on port 4042. Attempting port 4043.
19/12/02 21:46:48 WARN Utils: Service ‘SparkUI’ could not bind on port 4043. Attempting port 4044.
19/12/02 21:46:48 WARN Utils: Service ‘SparkUI’ could not bind on port 4044. Attempting port 4045.
19/12/02 21:46:48 WARN Utils: Service ‘SparkUI’ could not bind on port 4045. Attempting port 4046.
Traceback (most recent call last):
File “/Users/r/PycharmProjects/Spark/Spark.py”, line 3, in
print(sc.textFile("/Users/rocky/Documents/SparkTutorial/deckofcards.txt").first())
File “/Users/r/Documents/spark-2.4.4-bin-hadoop2.7/python/pyspark/rdd.py”, line 1378, in first
rs = self.take(1)
File “/Users/r/Documents/spark-2.4.4-bin-hadoop2.7/python/pyspark/rdd.py”, line 1327, in take
totalParts = self.getNumPartitions()
File “/Users/r/Documents/spark-2.4.4-bin-hadoop2.7/python/pyspark/rdd.py”, line 391, in getNumPartitions
return self._jrdd.partitions().size()
File “/Users/r/Documents/spark-2.4.4-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py”, line 1257, in call
File “/Users/r/Documents/spark-2.4.4-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py”, line 328, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o21.partitions.
: org.apache.hadoop.mapred.InvalidInputException: Input path does not exist: file:/Users/r/Documents/SparkTutorial/deckofcards.txt
at org.apache.hadoop.mapred.FileInputFormat.singleThreadedListStatus(FileInputFormat.java:287)
at org.apache.hadoop.mapred.FileInputFormat.listStatus(FileInputFormat.java:229)
at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java:315)
at org.apache.spark.rdd.HadoopRDD.getPartitions(HadoopRDD.scala:204)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:253)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:251)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:251)
at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:49)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:253)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:251)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:251)
at org.apache.spark.api.java.JavaRDDLike$class.partitions(JavaRDDLike.scala:61)
at org.apache.spark.api.java.AbstractJavaRDDLike.partitions(JavaRDDLike.scala:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)

Process finished with exit code 1

Hold on, read this through before raising topic in this category

Are you getting Permission denied, too many logins issue?
Don’t raise new ticket. Click here for the solution. If the issue persists after 30 minutes then raise new ticket

Go through other common issues in this category before raising any issue.