title: How to read a csv file from s3 bucket using pyspark
body: <p>I'm using Apache Spark 3.1.0 with Python 3.9.6. I'm trying to read csv file from AWS S3 bucket something like this:</p>
  <pre><code>spark = SparkSession.builder.getOrCreate()
  file = &quot;s3://bucket/file.csv&quot;
  
  c = spark.read\
      .csv(file)\
      .count()
  
  print(c)
  </code></pre>
  <p>But I'm getting the following error:</p>
  <pre><code>py4j.protocol.Py4JJavaError: An error occurred while calling o26.csv.
  : org.apache.hadoop.fs.UnsupportedFileSystemException: No FileSystem for scheme &quot;s3&quot;
  </code></pre>
  <p>I understand that I need add special libraries, but I didn't find any certain information which exactly and which versions. I've tried to add something like this to my code, but I'm still getting same error:</p>
  <pre><code>import os
  os.environ['PYSPARK_SUBMIT_ARGS'] = '--packages com.amazonaws:aws-java-sdk:1.7.4,org.apache.hadoop:hadoop-aws:2.7.3 pyspark-shell'
  </code></pre>
  <p>How can I fix this?</p>