[Errno 10048] error while attempting to bind on address

I got the follwoing error when running a newly created shiny "basic dashboard" app:

> shiny run app.py

INFO:     Started server process [24900]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
ERROR:    [Errno 10048] error while attempting to bind on address ('127.0.0.1', 8000): only one usage of each socket address (protocol/network address/port) is normally permitted

It seems that the port "127.0.0.1:8000" is occupied. So, I tried the suggestion to seach and kill the port by PID. But it's not working.

I found the previous shiny app I opened locally, and found that it's not responding to code changes at all.

My quesition is:

  1. Will Shiny shut down the port it uses when I close the app runnuing locally?
  2. How to solve such issue of a) app not responding to code change, and b) port is not accessible?

Thanks.

If the app is terminated (i.e. the shiny run app.py process is terminated, the port is freed up again. Disconnection via browser will keep the app running and hence the port will still be used.

If the app does not respone any more (e.g. to code changes), the best thing is to kill the process and restart the app.

In order to avoid hitting inaccessible ports when running the app locally, I would suggest to use

shiny run app.py -p 0

which will randomly assign a port to your app.

1 Like