What Causes the “socket.error: [Errno 48] Address already in use” Error?
After brief research, we found the causes to be:
Solution 1: Specifying Port Number
The error is mostly triggered when a person tries to bound a specific process to the default port and the default port is already bound to a different process. Therefore, in this step, we will be specifying the port on which the process is to be bounded.
Solution 2: Freeing up the Port
If the port is already in use by a different process, the new process will not be able to function on that port. Therefore, in this step, we will be freeing up the port by terminating the previous process and then running the new one. For that:
Solution 3: Restarting Raspberry Pi (Only For Raspberry Pi)
You can get rid of this error on Raspberry Pi by restarting the Raspberry Pi or by killing the terminal shell. The Raspberry Pi sometimes is unable to kill the processes automatically and triggers this error because of the previous processes already running on the ports.
Fix: ‘Command “python setup.py egg_info” failed with error code 1’ When…Fix: Indentation Error PythonFix: Google Drive ‘Error Loading Python DLL’How to Fix ‘CX_Freeze Python Error in Main Script’?