Fix “Address Already in Use” Error
How to find and stop the process that is already using a port on Linux.
How to find and stop the process that is already using a port on Linux.
This error happens when a program tries to bind to a port that another process is already using.
Example error:
OSError: [Errno 98] Address already in use
Example for port 5000:
lsof -i :5000
Example output:
python 1234 user TCP *:5000 (LISTEN)
Kill the process using the PID:
kill 1234
If it refuses to stop:
kill -9 1234
You can also use:
sudo fuser -k 5000/tcp
Score: 0
View-only mode. Editing requires your private owner token.
Comments
Loading comments...