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

Language packs break JupyterLab on Python 3.7 completely #11148

Closed
krassowski opened this issue Sep 25, 2021 · 4 comments · Fixed by jupyterlab/jupyterlab_server#213
Closed
Assignees
Labels
bug status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

Comments

@krassowski
Copy link
Member

krassowski commented Sep 25, 2021

Description

I just noticed while trying to test localization of an extension that language packs are broken with JupyterLab 3.1.13 and 3.1.12 (and possibly older too as the issue comes from jupyterlab_server/gettext) on binder, and they completely break JupyterLab UI once activated (by crashing server).

Reproduce

  1. Install a language pack on binder or use a repro gist: https://gist.github.com/krassowski/b1737a6d77d29ea08dd7d73f39d159c1
  2. Change language from Menu Settings → Language
  3. See the page does not reload
  4. See the error in console:
Traceback (most recent call last):
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/tornado/web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/tornado/web.py", line 3173, in wrapper
    return method(self, *args, **kwargs)
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/jupyterlab_server/settings_handler.py", line 54, in get
    translator=translator.translate_schema
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/jupyterlab_server/settings_utils.py", line 342, in get_settings
    schema = translator(schema)
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/jupyterlab_server/translation_utils.py", line 737, in translate_schema
    translator._translate_schema_strings(translations, schema.copy())
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/jupyterlab_server/translation_utils.py", line 696, in _translate_schema_strings
    schema[key] = translations.pgettext(context, value)
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/jupyterlab_server/translation_utils.py", line 490, in pgettext
    return gettext.dpgettext(self._domain, msgctxt, msgid)
AttributeError: module 'gettext' has no attribute 'dpgettext'
  1. Reload manually
  2. See JupyterLab not loading due to server errors

crash

Expected behavior

Language packs work, UI server does not crash

Context

  • Operating System and version: Linux Ubuntu 21.04
  • Browser and version: Chrome 92
  • JupyterLab version: 3.1.13
@krassowski krassowski added the bug label Sep 25, 2021
@krassowski
Copy link
Member Author

krassowski commented Sep 25, 2021

It seems that this Binder is currently picking Python 3.7.10. The context translations functions are only available in Python 3.8. I think that we did not use context translations prior to jupyterlab_server 2.8.0 (released 18 days ago) which included translation of settings schema (jupyterlab/jupyterlab_server#205 by @fcollonval).

It looks like other projects were bitten by this too: napari/napari#2299 and @goanpeca has had prepared a workaround there: napari/napari#2305. Should we just fallback to non-context alternatives too?

@krassowski
Copy link
Member Author

Also, I think that we should add integration testing across jupyterlab-language-packs, jupytelab-server and jupyterlab so that it does not happen again.

@krassowski krassowski changed the title Language packs break JupyterLab on binder completely Language packs break JupyterLab on Python 3.7 completely Sep 25, 2021
@goanpeca
Copy link
Member

It looks like other projects were bitten by this too: napari/napari#2299 and @goanpeca has had prepared a workaround there: napari/napari#2305. Should we just fallback to non-context alternatives too?

Sure, we can do that, will open a PR!

@goanpeca goanpeca self-assigned this Sep 25, 2021
@krassowski
Copy link
Member Author

Already opened one: jupyterlab/jupyterlab_server#213

@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Mar 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants