user2762934
user2762934

Reputation: 2452

Error loading Jupyter Notebook Extensions

I am using a Macbook with OS Sierra, and running Python 3.6.1 and Jupyter Notebook Server 5.0.0 I installed Jupyter Notebook extensions, following the instructions as mentioned on https://github.com/ipython-contrib/jupyter_contrib_nbextensions

While the notebooks work fine on my system, I cannot view the nbextensions tab. The following is the error log I see on running jupyter notebook in terminal. I have seen some related problems posted here on SO, but they seem to be about installing specific extensions.

Further, one of the solutions seemed to be suggest pip install jupyter_nbextensions_configurator, but as can be seen from the output below, I already have the extension installed.

Requirement already satisfied: traitlets in /usr/local/lib/python3.6/site-packages (from jupyter_nbextensions_configurator)
Requirement already satisfied: tornado in /usr/local/lib/python3.6/site-packages (from jupyter_nbextensions_configurator)

However, in the logs, you will notice that ModuleNotFoundError: No module named 'jupyter_nbextensions_configurator' is one of the error messages.

[W 08:44:49.973 NotebookApp] server_extensions is deprecated, use nbserver_extensions
[W 08:44:50.146 NotebookApp] Error loading server extension jupyter_nbextensions_configurator
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 1271, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 978, in _gcd_import
      File "<frozen importlib._bootstrap>", line 961, in _find_and_load
      File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'jupyter_nbextensions_configurator'
[I 08:44:50.158 NotebookApp] Serving notebooks from local directory: /Users/sp
[I 08:44:50.158 NotebookApp] 0 active kernels
[I 08:44:50.158 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=c777a7ab5dc6cf416c238b7b37f58d10ebea9db0743b46ae
[I 08:44:50.158 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 08:44:50.163 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=c777a7ab5dc6cf416c238b7b37f58d10ebea9db0743b46ae
[I 08:44:51.633 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[W 08:44:54.407 NotebookApp] 404 GET /nbextensions/nbextensions_configurator/tree_tab/main.js?v=20170511084449 (::1) 25.76ms referer=http://localhost:8888/tree

What am I missing here? Thanks!

Upvotes: 31

Views: 80217

Answers (8)

E L
E L

Reputation: 23

never use pip if you feel that there might be conflicts in the installation. Always use conda to take care of installation conflicts. considering the situation, I believe conda is the best package installer method to install anything in the live instance.

Upvotes: 0

the_daemon_lord
the_daemon_lord

Reputation: 769

I had the same problem. Here is how I solved it.

I have downloaded Anaconda python version 3.7. I already had Python 3.6.7 on my system.

I'd get this error if I did:

pip install jupyter_contrib_nbextensions

To solve it, I did:

python3.7 -m pip install jupyter_contrib_nbextensions

I have not tried this, but this could solve your problem too:

conda install -c conda-forge jupyter_nbextensions_configurator

So I guess the problem is because of there being multiple versions of Python on your system. The one which Anaconda uses and the one which the "normal pip" uses are probably different.

Upvotes: 30

Vito
Vito

Reputation: 1

I solved my problem by switching to the base environment in Anaconda and installing those packages. At the very beginning, I created a new environment in Anaconda because some conda-forge packages could not be installed. I used 'pip install' in my new environment. I installed those packages and the tab was not showing. The reason is even if I activated the new environment, the jupyter notebook is still initialed in the base environment. That is why the jupyter nootbook said 'no module found' in the beginning.

Upvotes: 0

legolagon
legolagon

Reputation: 139

I had the same error for a long time. Reinstalling nbconfig, changing settings, giving it extra time to load, validating installation before opening the notebook, etc. did not help.

What worked for me in the end was switching browsers! I switched from Safari on my Mac to Chrome and things are working perfectly! (Safari Version 13.0.2, mac OS High Sierra 10.13.6, Chrome Version 83.0.4103.61)

Upvotes: -1

Xiong-Hui Chen
Xiong-Hui Chen

Reputation: 410

I solved this problem by removing jupyter-notebook, jupyter_contrib_nbextensions, and jupyter_nbextensions_configurator, and starting it from scratch.

Note: It only works on Anaconda environment.

Uninstallation

For the different source of installation, you can remove these package through:

pip uninstall jupyter
pip uninstall jupyter_contrib_nbextensions
pip uninstall jupyter_nbextensions_configurator

or

conda remove --force jupyter notebook
conda remove --force jupyter_nbextensions_configurator
conda remove --force jupyter_contrib_nbextensions

But I'd advise you to run both of the above commands.

Installation

It's better to install all the packages from anaconda:

conda update notebook
conda install jupyter notebook
conda install -c conda-forge jupyter_nbextensions_configurator
conda install -c conda-forge jupyter_contrib_nbextensions

Upvotes: 13

zhoujl
zhoujl

Reputation: 1

I just had the same question, and i successfully fixed it by changing to specific environment (for example, tensorflow or py36), and then input "jupyter notebook". It works!

Upvotes: 0

jcb91
jcb91

Reputation: 649

It looks, from the server traceback, as though you've potentially got something weird going on with multiple python installs. Note that you're installing into a python in

/usr/local/lib/python3.6

but your notebook server traceback goes from there (where notebookapp seems to be running), but crosses over (in the importing call) to running from a (homebrew?) Python installed at

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6

A potentially hackish solution might be to just install into that cellar, and carry on as before, but I'd suggest maybe a little more investigation to decide why this is happening. Of relevance may be how you start the notebook server, install modules, run terminals, setup python paths, etc...

Upvotes: 0

mmngreco
mmngreco

Reputation: 556

I had the same problem, but I notice in the README of jupyterlab this:

Prerequisites

Jupyter notebook version 4.3 or later. To check the notebook version:

jupyter notebook --version

So, try to check your version with that command, if returns a version lower than 4.3, try update it:

conda update notebook

That is how I solved the problem.

Upvotes: 1

Related Questions