Jupyter-contrib / jupyter_nbextensions_configurator

A jupyter notebook serverextension providing config interfaces for nbextensions.
Other
981 stars 121 forks source link

X is nbextensions_configurator importable? #69

Open paulmadejong opened 6 years ago

paulmadejong commented 6 years ago

Jupyter came pre-installed on my work machine (on which i do not have root access).

I've installed the nbextensions using: pip3 install --user jupyter_contrib_nbextensions and jupyter contrib nbextensions install --user and manully added the ~/.local/bin to my PATH environment variable.

So far so good, but when launching jupyter, i get the following error:

jupyter notebook --no-browser --port=8889 --notebook-dir /
[I 14:26:24.684 NotebookApp] The port 8889 is already in use, trying another port.
[W 14:26:24.685 NotebookApp] Terminals not available (error was No module named 'terminado')
[W 14:26:24.687 NotebookApp] Error loading server extension jupyter_nbextensions_configurator
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/notebook/notebookapp.py", line 1271, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'jupyter_nbextensions_configurator'
[I 14:26:24.690 NotebookApp] Serving notebooks from local directory: /
[I 14:26:24.690 NotebookApp] 0 active kernels 
[I 14:26:24.690 NotebookApp] The Jupyter Notebook is running at: http://localhost:8890/
[I 14:26:24.690 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 14:26:25.621 NotebookApp] 404 GET /api/kernels/b50172bc-c47d-49c7-b863-de6a8f1a1c8a/channels?session_id=EF4DA16C1502431A8F3F846DE2B2549D (::1): Kernel does not exist: b50172bc-c47d-49c7-b863-de6a8f1a1c8a
[W 14:26:25.639 NotebookApp] 404 GET /api/kernels/b50172bc-c47d-49c7-b863-de6a8f1a1c8a/channels?session_id=EF4DA16C1502431A8F3F846DE2B2549D (::1) 27.43ms referer=None

Disabling the configurator resolves the issue, but i'd like it enabled which in turn yield the following error:

jupyter serverextension enable nbextensions_configurator
Enabling: nbextensions_configurator
- Writing config: /usr/people/jong/.jupyter
    - Validating...
Error loading server extension nbextensions_configurator
      X is nbextensions_configurator importable?

What am I doing wrong?

I'm running jupyter version 4.1.0

jcb91 commented 6 years ago

Hi!

In brief, I think you've follewed the correct process and aren't doing anything obviously wrong. Assuming that the jupyterhub notebook that you're running is also pip-installed with the user flag, it should work ok. If not, you may need to set the paths a little differently. It may equally be that you've been bitten by a bug or quirk of either the setup process, or perhaps your company machine setup.

It seems as though the jupyter_nbextensions_configurator package is not importable in the python environment from which the notebook server is running. You mention that you've added ~/.local/bin to the path, but it's the python source package that needs to be available - is that under bin? I can't recall offhand, but suspect it may be in .local/lib or something like that. It's also likely that it's the PYTHONPATH variable (where python looks for packages) that you need to set, rather than the PATH (where shell looks for executables). Relevant information would include output of

which jupyter
which jupyter-notebook
paulmadejong commented 6 years ago

Thanks for getting back to me. Please find below the outputs of several of the requested commands:

[bin]$ which jupyter
/usr/bin/jupyter
[bin]$ which jupyter-notebook
/usr/bin/jupyter-notebook
[bin]$ echo $PYTHONPATH
<empty>

Jupyter itself was pre-isntalled but nbextensions was installed indeed with the --user flag and hence jupyter_nbextensions_configurator resides in : ~/.local/lib/python3.6/site-packages

Should I add ~/.local/ to PYTHONPATH?

jcb91 commented 6 years ago

Ok, in that case, I think you should add ~/.local/lib/python3.6/site-packages to PYTHONPATH (pythonpath should point to the root of the import tree, in order to get namespaces correct).

paulmadejong commented 6 years ago

I added ~/.local/lib/python3.6/site-packages to PYTHONPATH as suggested but still at startup I get the error and also when enabling the configurator, the X is nb_extensions_configurator importable still appears.