title: How to set PYTHONHASHSEED on AWS EMR
body: <p>Is there any way to set an environment variable on all nodes of an EMR cluster?</p>
  
  <p>I am getting an error when trying to use reduceByKey() in Python3 PySpark, and getting an error regarding the hash seed. I can see this is a known error, and that the environment varialbe PYTHONHASHSEED needs to be set to the same value on all nodes of the cluster, but I haven't had any luck with it.</p>
  
  <p>I have tried adding a variable to spark-env through the cluster configuration:</p>
  
  <pre><code>[
    {
      "Classification": "spark-env",
  
        "Configurations": [
        {
           "Classification": "export",
           "Properties": {
            "PYSPARK_PYTHON": "/usr/bin/python3",
            "PYTHONHASHSEED": "123"
         }
       }
     ]
   },
   {
     "Classification": "spark",
     "Properties": {
       "maximizeResourceAllocation": "true"
      }
    }
  ]
  </code></pre>
  
  <p>but this doesn't work. I have also tried adding a bootstrap script:</p>
  
  <pre><code>#!/bin/bash
  export PYTHONHASHSEED=123
  </code></pre>
  
  <p>but this also doesn't seem to do the trick.</p>