How do I fix " Can't assign requested address"?

The full message looks like:

Exception in thread "main" Can't assign requested address: Service 'sparkDriver' failed after 16 retries!
Consider explicitly setting the appropriate port for the service 'sparkDriver' (for example spark.ui.port for SparkUI) to an available port or increasing spark.port.maxRetries.

This error is often caused by running spark on a machine connected to a VPN or a personal wi-fi hotspot (i.e. tethering to a phone). First, try fixing it by editing your hosts file as suggested in this StackOverflow post. If that fails, try running hail while disconnected from any VPN or personal wi-fi hotspot.

This worked for me:

sudo hostname -s

I’d note that the above is not a recommended solution – there are ways around this without changing the hostname.