0% found this document useful (0 votes)
566 views

OSError: Address "" Already in Use. Issue #33 Plotly:jupyter-Dash

Address Already in Use Error

Uploaded by

vaskore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
566 views

OSError: Address "" Already in Use. Issue #33 Plotly:jupyter-Dash

Address Already in Use Error

Uploaded by

vaskore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

🎉

plotly / jupyter-dash

Code Issues 24 Pull requests 5 Actions

New issue Jump to bottom

OSError: Address "" already in use. #33


Open peuleu opened this issue on 14 Aug 2020 · 14 comments

peuleu commented on 14 Aug 2020

Hi all!

I'm running into an error when trying to run app.run_server(mode='external')

Even if I kill all ports, and even if I change the port to a random number (for instance:
app.run_server(mode='external', port=2000) ), the error still persists. I don't know
how to resolve this. Help would be appreciated! Thanks!

Full error:

---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-5-0a3a9f2580ba> in <module>
----> 1 app.run_server(mode='external', port=2000)

/opt/anaconda3/lib/python3.7/site-packages/jupyter_dash/jupyter_app.py in run_s
317 )
318
--> 319 wait_for_app()
320
321 if JupyterDash._in_colab:

/opt/anaconda3/lib/python3.7/site-packages/retrying.py in wrapped_f(*args, **kw


47 @six.wraps(f)
48 def wrapped_f(*args, **kw):
---> 49 return Retrying(*dargs, **dkw).call(f, *args, **kw)
50
51 return wrapped_f

/opt/anaconda3/lib/python3.7/site-packages/retrying.py in call(self, fn, *args,


210 if not self._wrap_exception and attempt.has_exception:
211 # get() on an attempt with an exception should caus
--> 212 raise attempt.get()
213 else:
214 raise RetryError(attempt)

/opt/anaconda3/lib/python3.7/site-packages/retrying.py in get(self, wrap_except


245 raise RetryError(self)
246 else:
--> 247 six.reraise(self.value[0], self.value[1], self.value[2]
248 else:
249 return self.value

/opt/anaconda3/lib/python3.7/site-packages/six.py in reraise(tp, value, tb)


701 if value.__traceback__ is not tb:
702 raise value.with_traceback(tb)
--> 703 raise value
704 finally:
705 value = None

/opt/anaconda3/lib/python3.7/site-packages/retrying.py in call(self, fn, *args,


198 while True:
199 try:
--> 200 attempt = Attempt(fn(*args, **kwargs), attempt_number,
201 except:
202 tb = sys.exc_info()

/opt/anaconda3/lib/python3.7/site-packages/jupyter_dash/jupyter_app.py in wait_
313 "Address '{url}' already in use.\n"
314 " Try passing a different port to run_server.".f
--> 315 url=url
316 )
317 )

OSError: Address 'http://127.0.0.1:2000' already in use.


Try passing a different port to run_server.

ngloom commented on 19 Aug 2020

Help needed, I got the same Error too, thanks~

ccdavid commented on 21 Aug 2020

Unfortunately, the code always print that error regardless of the true reason of the
failure. I also got that error but the true cause was that jupyter-dash was trying to test
for success (access the _alive url) in a hostname that is not available in my
enviroinment (#32).

You can easily fix it inside the code of your module, and that's probably the
workaround for now because the authors of this library don't seem to be very
responsive.

kwtneo commented on 27 Nov 2020

ccdavid, could i trouble you to detail your fix/workaround with sample code? thanks

drorcohengithub commented on 7 Dec 2020 • edited

I have the same issue. No matter what I do I get the "Address already in use" error. I
am running jupyterlab on a server and am port-forwarding to local machine. More
info:

conda list | grep jupyter


jupyter 1.0.0 py37_7
jupyter-dash 0.3.1 pyhd8ed1ab_0 conda-forge
jupyter-server-proxy 1.0 py_0 plotly
jupyter_client 6.1.7 py_0
jupyter_console 6.2.0 py_0
jupyter_core 4.7.0 py37h06a4308_0
jupyterlab 2.2.6 py_0
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 1.2.0 py_0

conda list | grep dash


dash 1.17.0 pyhd8ed1ab_0 conda-forge
dash-core-components 1.13.0 pyhd8ed1ab_1 conda-forge
dash-html-components 1.1.1 pyh9f0ad1d_0 conda-forge
dash-renderer 1.8.3 pyhd8ed1ab_0 conda-forge
dash-table 4.11.0 pyhd8ed1ab_0 conda-forge
jupyter-dash 0.3.1 pyhd8ed1ab_0 conda-forge

jupyter labextension list


jupyterlab-dash v0.3.0 enabled OK

Jupyterlab has been rebuilt


Running the following (in individual cells):

from jupyter_dash import JupyterDash


from jupyter_dash.comms import _send_jupyter_config_comm_request
_send_jupyter_config_comm_request()
JupyterDash.infer_jupyter_proxy_config()
import jupyter_server_proxy
JupyterDash()._server_proxy
from jupyter_dash.comms import _jupyter_config
_jupyter_config

produces no error. Output from last two lines is

True
{'type': 'base_url_response',
'server_url': 'http://127.0.0.1:7001',
'base_subpath': '/',
'frontend': 'jupyterlab'}

However, app.run_server() always throws "OSError: Address 'http://0.0.0.0:xxxx'


already in use", no matter the mode or port number.

octavd commented on 11 Jan • edited

Hello,

I am having the same issue. Whatever port i put, it displays the error: "OSError:
Address 'http://0.0.0.0:xxxx' already in use"
@ccdavid could you please tell us what solution you've found?

@jonmmease , do you have any idea about this?

erikmajlath commented on 21 Jan

Hello,

Error that we are encountering is as @ccdavid mentioned default error anytime


python context cannot connect to the spawned dash server. As seen in the
https://github.com/plotly/jupyter-dash/blob/master/jupyter_dash/jupyter_app.py#L306

def wait_for_app():
res = requests.get(alive_url).content.decode()
if res != "Alive":
url = "http://{host}:{port}".format(
host=host, port=port, token=JupyterDash._token
)
raise OSError(
"Address '{url}' already in use.\n"
" Try passing a different port to run_server.".format(
url=url
)
)

After you call app.run_server(mode='external', port=8050) (or other mode, it does


not matter) it should spawn dash server. You can chceck by sudo netstat -nlp |
grep 8050 if the server is running you should see something like this:

tcp 0 0 127.0.0.1:8050 0.0.0.0:* LISTEN

Second option is to curl localhost with correct port to see if it's accessible curl
http://localhost:8050 should return dash-like response for example:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<title>Dash</title>
...

If dash server is running successfully and you are getting error mentioned above
there is an issue with connecting from python to the localhost. Solution will depend
on your setup. My problem was that container in which I run jupyter lab used proxy
and was connecting to different localhost. Ignoring proxy for localhost solved my
problem.

captain-proton commented on 5 Feb

Hello all,

had the same error no matter what mode was used. The link to the address that is
said to be already in use leads to an error page of the Flask server. The page displays
a message that no layout was set in the app. The following snippet led to success:

from jupyter_dash import JupyterDash


import dash_html_components as html

app = JupyterDash(__name__)
app.layout = html.Div([
html.H3("Largest evaluation of all time")
])
app.run_server(mode='jupyterlab')

layne-sadler commented on 5 Feb • edited

Is the port already in use by another service at the OS level? See how 2000 is in use
but 2194-2196 are blank?
http://www.networksorcery.com/enp/protocol/ip/ports02000.htm

octavd commented on 5 Feb

For my case, whatever port i've used it gave me that error.

dragoljub commented on 6 Mar

I'm running into the same issue. Its happening on Windows 10, Python 3.7 x64. Latest
versions of JupyterLab Dash and JupyterDash. Once you run the cell in the notebook
the dash server is started and I can navigate to it externally where everything works,
but it does not show up inline and just gives the error regardless of the mode
argument.

---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-1-c022ec548b22> in <module>
6 html.H3("Largest evaluation of all time")
7 ])
----> 8 app.run_server(mode='inline')

d:\python37\lib\site-packages\jupyter_dash\jupyter_app.py in run_server(self, m
317 )
318
--> 319 wait_for_app()
320
321 if JupyterDash._in_colab:

d:\python37\lib\site-packages\retrying.py in wrapped_f(*args, **kw)


47 @six.wraps(f)
48 def wrapped_f(*args, **kw):
---> 49 return Retrying(*dargs, **dkw).call(f, *args, **kw)
50
51 return wrapped_f

d:\python37\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)


210 if not self._wrap_exception and attempt.has_exception:
211 # get() on an attempt with an exception should caus
--> 212 raise attempt.get()
213 else:
214 raise RetryError(attempt)

d:\python37\lib\site-packages\retrying.py in get(self, wrap_exception)


245 raise RetryError(self)
246 else:
--> 247 six.reraise(self.value[0], self.value[1], self.value[2]
248 else:
249 return self.value

d:\python37\lib\site-packages\six.py in reraise(tp, value, tb)


701 if value.__traceback__ is not tb:
702 raise value.with_traceback(tb)
--> 703 raise value
704 finally:
705 value = None

d:\python37\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)


198 while True:
199 try:
--> 200 attempt = Attempt(fn(*args, **kwargs), attempt_number,
201 except:
202 tb = sys.exc_info()

d:\python37\lib\site-packages\jupyter_dash\jupyter_app.py in wait_for_app()
313 "Address '{url}' already in use.\n"
314 " Try passing a different port to run_server.".f
--> 315 url=url
316 )
317 )

OSError: Address 'http://127.0.0.1:8050' already in use.


Try passing a different port to run_server.

jupyter-dash 0.4.0

retrying 1.3.3

dash 1.19.0
dash-core-components 1.15.0
dash-html-components 1.1.2
dash-renderer 1.9.0
dash-table 4.11.2

jupyter --version
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.3
ipython : 7.13.0
ipykernel : 5.2.1
jupyter client : 6.1.3
jupyter lab : 3.0.9
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.6
traitlets : 4.3.3

mintaow commented on 10 Mar

Hey folks, not sure if my solution helps because my error is "NoLayout Exception"
even though I did create them, but there is the same message "OSError: Address
'http://127.0.0.1:2000' already in use. Try passing a different port to
run_server." at the bottom.

I am working on Google Colab. I just restarted the Colab, and things got solved.

dragoljub commented on 11 Mar

@mintaow

What versions of dash and Jupyter and python are you using?

I tested the same code in Linux Virtual environment with same results on Python 3.8
and latest versions of Dash and Jupyter.

mintaow commented on 11 Mar

@mintaow

What versions of dash and Jupyter and python are you using?

I tested the same code in Linux Virtual environment with same results on Python
3.8 and latest versions of Dash and Jupyter.

I am just using the default Google Colab settings for Python and Jupyter. I think Colab
is using Python 3.6.9. For Dash, I am !pip install jupyter-dash every time I
reconnect to Colab so I guess it is the latest version.

nijatullahmansoor commented 11 hours ago

app.run_server(mode="inline", host="localhost",port=8051)

so just pass different parameter port=? port number which is valid and not used I
tried this it work for me
OSError: Address 'http://127.0.0.1:8050' already in use.
Try passing a different port to run_server.

Write Preview

Leave a comment

Comment

Remember, contributions to this repository should follow our GitHub Community Guidelines.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Linked pull requests

Successfully merging a pull request may close this issue.

None yet

Notifications Customize

Subscribe

You’re not receiving notifications from this thread.

12 participants

© 2021 GitHub, Inc. Terms Privacy Security Status Docs

Contact GitHub Pricing API Training Blog About

You might also like