Setting of PYTHONHASHSEED has no effect
Problem

  
    
      pytorch-lightning/pytorch_lightning/trainer/seed.py
    
    
         Line 32
      in
      caa9c67
    
  
  
    

        
          
           os.environ["PYTHONHASHSEED"] = str(seed) 
        
    
  


It is not possible to change PYTHONHASHSEED inside the current program.
To see this, run the following two commands:
PYTHONHASHSEED=1 python -c "import os; print(hash('a'))"
PYTHONHASHSEED=1 python -c "import os; os.environ['PYTHONHASHSEED']='2'; print(hash('a'))"

The commands should output the same value, meaning that setting PYTHONHASHSEED after the process has started has no effect.
The following commands should output different values, also indicating that setting PYTHONHASHSEED after the process has started has no effect:
unset PYTHONHASHSEED # make sure it is not already set
python -c "import os; os.environ['PYTHONHASHSEED']='2'; print(hash('a'))"
python -c "import os; os.environ['PYTHONHASHSEED']='2'; print(hash('a'))"

edit: fixed second example
Solutions
Some ways I can think of to solve this:

Emit a warning if PYTHONHASHSEED is not 0 (0 means hash randomization is disabled)
Restarts the current process with PYTHONHASHSEED defined, see my snippet below. (This should be done as early as possible, to avoid non-idempotent code being executed twice.)

Personally I set PYTHONHASHSEED=0 in all of my .zshrc, but I also use the ensure_pythonhashseed function below.
For pytorch-lightning, I prefer solution 1, because it is less complicated, both to implement correctly and for users to reason about.
Snippet
def ensure_pythonhashseed(seed=0):
    current_seed = os.environ.get("PYTHONHASHSEED")

    seed = str(seed)
    if current_seed is None or current_seed != seed:
        print(f'Setting PYTHONHASHSEED="{seed}"')
        os.environ["PYTHONHASHSEED"] = seed
        # restart the current process
        os.execl(sys.executable, sys.executable, *sys.argv)