jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.05k stars 342 forks source link

Following docs for enabling extensions fails #941

Open mineshaftgap opened 1 year ago

mineshaftgap commented 1 year ago

Bug description

Following the documentation for "Enabling Jupyter Notebook extensions" fails.

How to reproduce

  1. su - jupyter-admin -s /bin/bash
  2. source /opt/tljh/user/bin/activate
  3. sudo -E pip install jupyter_contrib_nbextensions
  4. sudo -E jupyter contrib nbextension install --sys-prefix

Error:

Traceback (most recent call last):
  File "/opt/tljh/user/bin/jupyter-contrib", line 8, in <module>
    sys.exit(main())
  File "/opt/tljh/user/lib/python3.10/site-packages/jupyter_core/application.py", line 285, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/opt/tljh/user/lib/python3.10/site-packages/traitlets/config/application.py", line 1044, in launch_instance
    app = cls.instance(**kwargs)
  File "/opt/tljh/user/lib/python3.10/site-packages/traitlets/config/configurable.py", line 555, in instance
    inst = cls(*args, **kwargs)
  File "/opt/tljh/user/lib/python3.10/site-packages/jupyter_contrib_core/application.py", line 27, in __init__
    self._refresh_subcommands()
  File "/opt/tljh/user/lib/python3.10/site-packages/jupyter_contrib_core/application.py", line 43, in _refresh_subcommands
    get_subcommands_dict = entrypoint.load()
  File "/opt/tljh/user/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in load
    return self.resolve()
  File "/opt/tljh/user/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/opt/tljh/user/lib/python3.10/site-packages/jupyter_contrib_nbextensions/__init__.py", line 5, in <module>
    import jupyter_nbextensions_configurator
  File "/opt/tljh/user/lib/python3.10/site-packages/jupyter_nbextensions_configurator/__init__.py", line 18, in <module>
    from notebook.base.handlers import APIHandler, IPythonHandler
ModuleNotFoundError: No module named 'notebook.base'

Expected behaviour

That the instructions work.

Actual behaviour

Error: "ModuleNotFoundError: No module named 'notebook.base'"

Your personal set up

Full environment ``` sudo's -H flag. aiohttp==3.8.5 aiosignal==1.3.1 alembic==1.12.0 anyio==4.0.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 asttokens==2.4.0 async-generator==1.10 async-lru==2.0.4 async-timeout==4.0.3 attrs==23.1.0 Babel==2.12.1 backcall==0.2.0 backoff==2.2.1 beautifulsoup4==4.12.2 bleach==6.0.0 boltons @ file:///home/conda/feedstock_root/build_artifacts/boltons_1677499911949/work brotlipy @ file:///home/conda/feedstock_root/build_artifacts/brotlipy_1666764671472/work certifi==2023.7.22 certipy==0.1.3 cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1671179353105/work charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1678108872112/work click==8.1.7 colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work comm==0.1.4 conda==23.3.1 conda-libmamba-solver @ file:///home/conda/feedstock_root/build_artifacts/conda-libmamba-solver_1680508672016/work/src conda-package-handling @ file:///home/conda/feedstock_root/build_artifacts/conda-package-handling_1669907009957/work conda_package_streaming @ file:///home/conda/feedstock_root/build_artifacts/conda-package-streaming_1669733752472/work cryptography @ file:///home/conda/feedstock_root/build_artifacts/cryptography-split_1679811212387/work debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 dnspython==2.4.2 exceptiongroup==1.1.3 executing==1.2.0 fastjsonschema==2.18.0 fqdn==1.5.1 frozenlist==1.4.0 GDAL @ file:///home/conda/feedstock_root/build_artifacts/gdal-split_1680712150998/work/build/swig/python gitdb==4.0.10 GitPython==3.1.36 greenlet==2.0.2 idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1663625384323/work ipykernel==6.25.2 ipython==8.15.0 ipython-genutils==0.2.0 ipython-sql==0.5.0 ipywidgets==8.1.1 isoduration==20.11.0 jedi==0.19.0 Jinja2==3.1.2 json5==0.9.14 jsonpatch @ file:///home/conda/feedstock_root/build_artifacts/jsonpatch_1632759296524/work jsonpointer @ file:///home/conda/feedstock_root/build_artifacts/jsonpointer_1694629056817/work jsonschema==4.19.0 jsonschema-specifications==2023.7.1 jupysql==0.10.1 jupyter-contrib-core==0.4.2 jupyter-contrib-nbextensions==0.7.0 jupyter-events==0.7.0 jupyter-highlight-selected-word==0.2.0 jupyter-lsp==2.2.0 jupyter-nbextensions-configurator==0.6.3 jupyter-resource-usage==1.0.1 jupyter-server-mathjax==0.2.6 jupyter-telemetry==0.1.0 jupyter_client==8.3.1 jupyter_core==5.3.1 jupyter_server==2.7.3 jupyter_server_terminals==0.4.4 jupyterhub==4.0.2 jupyterlab==4.0.6 jupyterlab-pygments==0.2.2 jupyterlab-widgets==3.0.9 jupyterlab_git==0.42.0 jupyterlab_server==2.25.0 libmambapy @ file:///home/conda/feedstock_root/build_artifacts/mamba-split_1680002410624/work/libmambapy loguru==0.7.2 lxml==4.9.3 Mako==1.2.4 mamba @ file:///home/conda/feedstock_root/build_artifacts/mamba-split_1680002410624/work/mamba MarkupSafe==2.1.3 matplotlib-inline==0.1.6 mistune==3.0.1 monotonic==1.6 multidict==6.0.4 nbclient==0.8.0 nbconvert==7.8.0 nbdime==3.2.1 nbformat==5.9.2 nbgitpuller==1.2.0 nest-asyncio==1.5.8 notebook==7.0.3 notebook_shim==0.2.3 numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1694920012608/work/dist/numpy-1.26.0-cp310-cp310-linux_x86_64.whl#sha256=67dc2959fa1b177be67bafdb522fcaa9f7b67db21ab0908c7d0c1d7303c51ecd oauthlib==3.2.2 openai==0.28.0 overrides==7.4.0 packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1681337016113/work pamela==1.1.0 pandas==2.1.0 pandocfilters==1.5.0 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 pinecone-client==2.2.4 platformdirs==3.10.0 ploomber-core==0.2.14 pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1667232663820/work posthog==3.0.2 prettytable==3.9.0 prometheus-client==0.17.1 prompt-toolkit==3.0.39 psutil==5.9.5 psycopg2==2.9.7 ptyprocess==0.7.0 pure-eval==0.2.2 pycosat @ file:///home/conda/feedstock_root/build_artifacts/pycosat_1666836542287/work pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work Pygments==2.16.1 pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1680037383858/work PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work python-dateutil==2.8.2 python-dotenv==1.0.0 python-json-logger==2.0.7 pytz==2023.3.post1 PyYAML==6.0.1 pyzmq==25.1.1 referencing==0.30.2 requests==2.31.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rpds-py==0.10.3 ruamel.yaml @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml_1678272977710/work ruamel.yaml.clib @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml.clib_1670412719074/work Send2Trash==1.8.2 six==1.16.0 smmap==5.0.1 sniffio==1.3.0 soupsieve==2.5 SQLAlchemy==2.0.20 sqlglot==18.5.1 sqlparse==0.4.4 stack-data==0.6.2 terminado==0.17.1 there==0.0.12 tinycss2==1.2.1 tomli==2.0.1 toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1657485559105/work tornado==6.3.3 tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1677948868469/work traitlets==5.10.0 typing_extensions==4.7.1 tzdata==2023.3 uri-template==1.3.0 urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1678635778344/work wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 websocket-client==1.6.3 widgetsnbextension==4.0.9 yarl==1.9.2 zstandard==0.19.0 ```
Configuration ```python """ JupyterHub config for the littlest jupyterhub. """ import os from glob import glob from tljh import configurer from tljh.config import CONFIG_DIR, INSTALL_PREFIX, USER_ENV_PREFIX from tljh.user_creating_spawner import UserCreatingSpawner from tljh.utils import get_plugin_manager c = get_config() # noqa c.JupyterHub.spawner_class = UserCreatingSpawner c.JupyterHub.cleanup_servers = False c.JupyterHub.hub_port = 15001 c.TraefikProxy.should_start = False dynamic_conf_file_path = os.path.join(INSTALL_PREFIX, "state", "rules", "rules.toml") c.TraefikFileProviderProxy.dynamic_config_file = dynamic_conf_file_path c.JupyterHub.proxy_class = "traefik_file" c.SystemdSpawner.extra_paths = [os.path.join(USER_ENV_PREFIX, "bin")] c.SystemdSpawner.default_shell = "/bin/bash" c.SystemdSpawner.unit_name_template = "jupyter-{USERNAME}" tljh_config = configurer.load_config() configurer.apply_config(tljh_config, c) pm = get_plugin_manager() pm.hook.tljh_custom_jupyterhub_config(c=c) extra_configs = sorted(glob(os.path.join(CONFIG_DIR, "jupyterhub_config.d", "*.py"))) for ec in extra_configs: load_subconfig(ec) ```
Logs ``` # paste relevant logs here, if any ```
welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: