Open sammyaboum opened 6 years ago
So it looks like there's a syntax error in one of your json config files which prevents the configurator from loading it correctly. This could (should, imo) also be considered an error in the jupyter_nbextensions_configurator which renders this page, in that it doesn't report the fact that the file failed to load, leaving you hanging with no information.
From this line in your traceback:
File "C:\Users\sammy\Anaconda3\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 6 column 22 (char 137)
I suspect that the problem is that you've left a trailing comma in an array in the json config file at C:\Users\sammy\.jupyter\nbconfig\notebook.json
. Specifically, the comma in question seems to be on line 6, column 22. In the short term, you'll need to fix that json file manually. For future use, I should fix the configurator to add reports for errors like this...
@jcb91 thanks for your quick reply. Here's a copy of the json file
{
"load_extensions": {
"jupyter-js-widgets/extension": true,
"jupyter_dashboards/notebook/main": true,
"rise/main": true,
"nbextensions_configurator/config_menu/main": true,
"contrib_nbextensions_help_item/main": true
}
}
Should I remove the comas for lines 3 4 5 and 6 or just 6?
Hmm, that file looks ok, actually. In that case, it must be in some other config fie :thinking:
@jcb91 what's the next step to get it to work then? 👍
what's the output of jupyter nbextension list
?
C:\Users\sammy>jupyter nbextension list
Known nbextensions:
Traceback (most recent call last):
File "C:\Users\sammy\Anaconda3\Scripts\jupyter-nbextension-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\sammy\Anaconda3\lib\site-packages\jupyter_core\application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\sammy\Anaconda3\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Users\sammy\Anaconda3\lib\site-packages\notebook\nbextensions.py", line 988, in start
super(NBExtensionApp, self).start()
File "C:\Users\sammy\Anaconda3\lib\site-packages\jupyter_core\application.py", line 255, in start
self.subapp.start()
File "C:\Users\sammy\Anaconda3\lib\site-packages\notebook\nbextensions.py", line 960, in start
self.list_nbextensions()
File "C:\Users\sammy\Anaconda3\lib\site-packages\notebook\nbextensions.py", line 943, in list_nbextensions
data = cm.get(section)
File "C:\Users\sammy\Anaconda3\lib\site-packages\traitlets\config\manager.py", line 63, in get
return json.load(f)
File "C:\Users\sammy\Anaconda3\lib\json\__init__.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\sammy\Anaconda3\lib\json\__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "C:\Users\sammy\Anaconda3\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\sammy\Anaconda3\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 6 column 22 (char 137)
and what about jupyter nbextension --version
?
You can use three backticks (`) before & after to format a markdown paragraph as code, e.g.
```
some code/command output here
```
C:\Users\sammy>jupyter nbextension --version
5.2.2
Haha couldn't figure out the backticks, thanks!
Haha couldn't figure out the backticks, thanks!
You've used apostrophes (') instead of backticks (`). Alternatively, you can start the line with four spaces.
Ok, can you try the following python snippet:
import os
from json.decoder import JSONDecodeError
from jupyter_core.paths import jupyter_config_path
from traitlets.config.manager import BaseJSONConfigManager
for p in jupyter_config_path():
cm = BaseJSONConfigManager(config_dir=os.path.join(p, 'nbconfig'))
for section in ['common', 'notebook', 'tree', 'edit', 'terminal']:
if os.path.exists(cm.file_name(section)):
try:
data = cm.get(section)
except JSONDecodeError:
print('error: {}'.format(cm.file_name(section)))
else:
if data:
print('valid: {}'.format(cm.file_name(section)))
valid: C:\Users\sammy\.jupyter\nbconfig\common.json
error: C:\Users\sammy\.jupyter\nbconfig\notebook.json
valid: C:\Users\sammy\.jupyter\nbconfig\tree.json
valid: C:\Users\sammy\.jupyter\nbconfig\edit.json
valid: C:\Users\sammy\.jupyter\nbconfig\terminal.json
valid: C:\Users\sammy\Anaconda3\etc\jupyter\nbconfig\common.json
valid: C:\Users\sammy\Anaconda3\etc\jupyter\nbconfig\notebook.json
valid: C:\Users\sammy\Anaconda3\etc\jupyter\nbconfig\tree.json
valid: C:\Users\sammy\Anaconda3\etc\jupyter\nbconfig\edit.json
valid: C:\Users\sammy\Anaconda3\etc\jupyter\nbconfig\terminal.json
valid: C:\ProgramData\jupyter\nbconfig\common.json
valid: C:\ProgramData\jupyter\nbconfig\notebook.json
valid: C:\ProgramData\jupyter\nbconfig\tree.json
valid: C:\ProgramData\jupyter\nbconfig\edit.json
valid: C:\ProgramData\jupyter\nbconfig\terminal.json
Does it matter where I execute this piece of code?
Does it matter where I execute this piece of code?
It should be fine to run from any directory, as long as the anaconda environment from which you run your notebook server is active.
Ok, so that pretty clearly points to an error in C:\Users\sammy\.jupyter\nbconfig\notebook.json
. The content you posted before doesn't have any obvious error in it though. Could you double-check the contents? You could also try removing the contents of that file, then re-add it all bit-by-bit to see what the problem is...
{
"load_extensions": {
"jupyter-notebook-gist/extension": true,
"jupyter-js-widgets/extension": true
},
"oauth_client_id":
Sorry, I sent the wrong content earlier..
Sorry, I sent the wrong content earlier..
Ok, no worries! Right, that definitely looks a bit broken. If that is all of it, and not just the start, then the file's missing some stuff. It appears though that it's not a trailing comma, but that the oauth_client_id
key is missing a value, and the main object is missing its closing }
. The presence of the key implies you may be ~running in an environment using jupyterhub~ using mozilla/jupyter-notebook-gist?
A simple fix for the file is to clip it to
{
"load_extensions": {
"jupyter-notebook-gist/extension": true,
"jupyter-js-widgets/extension": true
}
}
But of course you may still have other separate problems left over as a result of that oauth_client_id
...
When doing this fix it goes from error to valid. I tried jupyter nbextension list
again and got the following:
Known nbextensions:
config dir: C:\Users\sammy\.jupyter\nbconfig
notebook section
jupyter-notebook-gist/extension enabled
- Validating: ok
jupyter-js-widgets/extension enabled
- Validating: ok
config dir: C:\Users\sammy\Anaconda3\etc\jupyter\nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: ok
jupyter_dashboards/notebook/main enabled
- Validating: ok
rise/main enabled
- Validating: ok
nbextensions_configurator/config_menu/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/config_menu/main
contrib_nbextensions_help_item/main enabled
- Validating: ok
tree section
ipyparallel/main enabled
- Validating: ok
nbextensions_configurator/tree_tab/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/tree_tab/main
config dir: C:\ProgramData\jupyter\nbconfig
notebook section
nbextensions_configurator/config_menu/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/config_menu/main
contrib_nbextensions_help_item/main enabled
- Validating: ok
tree section
ipyparallel/main enabled
- Validating: ok
nbextensions_configurator/tree_tab/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/tree_tab/main```
I followed the steps of the mozilla/jupyter-notebook-gist and it seems to work, more or less. When double checking as per the steps, it seems in order for the serverextension but not the nbextension. Also, for the configuration part, which info should I enter exactly? And looking at the picture, how does that look to you?
Great, all looks pretty much as I'd expect it to now, seems to be working ok.
The 'validation errors' in the list output about nbextensions_configurator/config_menu/main
and nbextensions_configurator/tree_tab/main
) are actually not errors, they're just produced by the way the serverextension is implemented (see https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator/issues/37 for further details). The nbextensions which are yellowed out are also probably fine, they just provide no information (via yaml files) for the configurator to know how to interact with them.
for the configuration part, which info should I enter exactly?
That entirely depends on what it is that you wish to configure 😆. In general, you can click on the various nbextensions, and see what options they offer. Most shouldn't require you to configure anything in order to function, as they generally set reasonable default values to work at least partly straight out-of-the-box...
Okay, configuration sounded more like a username/password kind of thing to me. Thank you SO much for your help, I really appreciate it.
@jcb91 small problem. I closed jupyter, opened it again and back to case 1. The reload figure is showing again...
@jcb91 small problem. I closed jupyter, opened it again and back to case 1. The reload figure is showing again...
Hmm, that's far from ideal 😞. What do the contents of C:\Users\sammy\.jupyter\nbconfig\notebook.json
look like now? Without further information, my best guess at the moment is that jupyter_notebook_gist/config.py#L22-L24, which gets called at server-load, is somehow messing up its edit of the config file... :man_shrugging:
It was 8 or 9 lines, some ending with true some with false but I just edited it to
{
"load_extensions": {
"jupyter-notebook-gist/extension": true,
"jupyter-js-widgets/extension": true
}
}
Still failing..
Update: I executed the code from the link you shared and MAGIC: it works again..
Update 2: Seems like each time I close jupyter I have to take two steps before nbextensions functions again. 1- Edit the C:\Users\sammy\.jupyter\nbconfig\notebook.json
file and execute the contents of jupyter_notebook_gist/config.py#L22-L24
Update 2: Seems like each time I close jupyter I have to take two steps before nbextensions functionning again. 1- Edit the
C:\Users\sammy\.jupyter\nbconfig\notebook.json
file and execute the contents of jupyter_notebook_gist/config.py#L22-L24
Ok, in that case I think this is a reasonably clear indication that it's a problem resulting from the way jupyter-notebook-gist attempts to edit the config file as the server loads, although I don't know why. Perhaps there's an underlying issue from traitlets.config
, or some detail of implementation that means this use-case is unsupported. I'm not sure. Anyway, given it's that extension causing issues, it's probably worth raising an issue there, perhaps they could only edit the config file if it actually needs changing?
I will do that. Considering I only joined HitHub yesterday, should I write it in details or just link it to this thread?
Considering I only joined HitHub yesterday, should I write it in details or just link it to this thread?
I should think a summary of the problem (editing config file on server load results in json syntax errors), plus a link to this issue should suffice, but up to you! Good job on your first day here! 😆
Also, as a temporary fix, you could either disable jupyter-notebook-gist, or comment the relevant lines of its config module out, so they don't run every time the server does...
I will follow your advice.
Still at a learning phase so it's no big deal for now :)
Many many thanks for all your help.
Hello everyone, I am pretty new to this so please bear with me. I am trying to get the nbextensions to work using the steps on the following link: https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html and it is failing. When going to the nbextensions page, there is a reload symbol that keeps rotating and a reload button on the top right. When clicking it, the symbol starts rotating again but nothing appears on my screen.
Following the steps on the link, I am able to install it using both pip and conda with no error. Skipping to step 3, and executing
jupyter contrib nbextension install --user
, I get the following:Any idea about what I should do? Many thanks!