Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [Errno 99] Cannot assign requested address if the path is wrong in vosk.Model(path) in streamlit #62

Open
mohammedi-haroune opened this issue Apr 14, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@mohammedi-haroune
Copy link

mohammedi-haroune commented Apr 14, 2021

Describe the bug

I noticed a bug when using cdsdashboards in our ML platform https://iko.ai

OSError: [Errno 99] Cannot assign requested address is returned both in the browser and the logs if the path is wrong in vosk.Model(path) in a streamlit app

It first shows the right error:

INFO:tornado.application:Process mainprocess failed with stdout: 2021-04-14 08:55:47.238 An update   to the [server] config option section was detected. To have these changes be reflected, please       restart streamlit.
LOG (VoskAPI:ReadDataFiles():model.cc:196) Decoding params beam=13 max-active=7000 lattice-beam=6
LOG (VoskAPI:ReadDataFiles():model.cc:199) Silence phones 1:2:3:4:5:6:7:8:9:10
ERROR (VoskAPI:ReadConfigFile():parse-options.cc:462) Cannot open config file: makach-menha/mfcc.conf
terminate called after throwing an instance of 'kaldi::KaldiFatalError'
  what():  kaldi::KaldiFatalError

Then it keeps showing this weird error both in the browser and the logs

HTTPServerRequest(protocol='http', host='172.17.0.1', method='GET', uri='/notebook/jupyter/user/     haroune/iko-streamlit-bug/stream', version='HTTP/1.1', remote_ip='172.17.0.1')
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/tornado/tcpclient.py", line 138, in on_connect_done
    stream = future.result()
tornado.iostream.StreamClosedError: Stream is closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
    result = await result
  File "/opt/conda/lib/python3.8/site-packages/jhsingle_native_proxy/websocket.py", line 105, in get
    return await self.ws_get(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/jhsingle_native_proxy/proxyhandlers.py", line 339, in ws_get
    await self._ws_open_proxy('localhost', self.port, path)
  File "/opt/conda/lib/python3.8/site-packages/jhsingle_native_proxy/proxyhandlers.py", line 413, in _ws_open_proxy
    self.ws = await pingable_ws_connect(request=request,
  File "/opt/conda/lib/python3.8/site-packages/tornado/iostream.py", line 1205, in connect
    self.socket.connect(address)
OSError: [Errno 99] Cannot assign requested address

Also, this happened only once, the streamlit UI opened and keeps rerunning the app forever and show an error pop every now and then. I couldn't take a screenshot of the error in the streamlit UI because it was too fast.

To Reproduce

  • Install vosk: pip install vosk
  • Create a streamlit dashboard with the following content:
from vosk import Model

model = Model('wrong/path/')

Screenshots

Screenshot-20210414100015-3072x1728

Configuration

from cdsdashboards.app import CDS_TEMPLATE_PATHS
from cdsdashboards.hubextension import cds_extra_handlers

c.JupyterHub.template_paths = CDS_TEMPLATE_PATHS
c.JupyterHub.extra_handlers = cds_extra_handlers

c.JupyterHub.allow_named_servers = True
c.CDSDashboardsConfig.builder_class = 'cdsdashboards.builder.kubebuilder.KubeBuilder'

# # Add `start.sh` to switch to NB_USER before running the command
c.VariableMixin.default_presentation_cmd = ['start.sh', 'python3', '-m', 'jhsingle_native_proxy.main']

# Options to remove Named Server / Dashboard sections for users on their home page. 
# You can remove the named server section and/or the new bottom section where 
# servers started to act as dashboards are hidden.
c.JupyterHub.template_vars = {
    'cds_hide_user_named_servers': True,
    'cds_hide_user_dashboard_servers': False,
}

# Specify how to name dashbaord servers
c.CDSDashboardsConfig.server_name_template = 'iko-{urlname}'

# Control whether ‘All Users’ or ‘Selected Users’ is selected by default on the ‘New Dashboard’ page.
c.CDSDashboardsConfig.default_allow_all = False

# Show Spawner User Options Form before creating a dashboard
c.CDSDashboardsConfig.spawn_default_options = False

c.CDSDashboardsConfig.presentation_types = ['voila', 'streamlit', 'plotlydash', 'bokeh']

from cdsdashboards.hubextension.spawners.variablekube import VariableKubeSpawner

class CustomKubeSpawner(VariableKubeSpawner):
    "Our custom KubeSpawner implementation"
    pass

c.JupyterHub.spawner_class = CustomKubeSpawner
@mohammedi-haroune mohammedi-haroune added the bug Something isn't working label Apr 14, 2021
@mohammedi-haroune
Copy link
Author

Here's the full logs:
vosk_bug.log

@danlester
Copy link
Member

What happens if you run this in Streamlit locally, i.e. just on your laptop say?

And I presume if you use the right path the app works fine?

@mohammedi-haroune
Copy link
Author

What happens if you run this in Streamlit locally, i.e. just on your laptop say?

The app logs the error and exit.

> streamlit run streamlit_app-wrong-input-path.py 

  You can now view your Streamlit app in your browser.

  Network URL: http://10.4.1.17:8501
  External URL: http://34.123.120.237:8501

LOG (VoskAPI:ReadDataFiles():model.cc:194) Decoding params beam=13 max-active=7000 lattice-beam=6
LOG (VoskAPI:ReadDataFiles():model.cc:197) Silence phones 1:2:3:4:5:6:7:8:9:10
ERROR (VoskAPI:ReadConfigFile():parse-options.cc:462) Cannot open config file: /tmp/vosk-model-ar-mgb2-0.4/mfcc.conf
terminate called after throwing an instance of 'kaldi::KaldiFatalError'
  what():  kaldi::KaldiFatalError
Aborted

And I presume if you use the right path the app works fine?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants