Help Installing jupyter extensions on Windows 7 machine

404 views
Skip to first unread message

pybokeh

unread,
Sep 11, 2015, 10:37:16 AM9/11/15
to Project Jupyter
Hello,
I'm having a difficult time installing notebook extensions in jupyter on my Windows 7 machine.  I am following along per the docs at https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/Home_Jupyter

I've set 2 environment variables:
set JUPYTER_CONFIG_DIR=d:\.profiles
set JUPYTER_PATH=d:\.profiles\nbextensions

######  config path #########
print(jupyter_config_dir()) results in:
d:\.profiles

print(jupyter_config_path()) results in:
['d:\\.profiles', 'D:\\Miniconda3\\envs\\data_analysis\\etc\\jupyter', 'D:\\ProgramData\\jupyter']


##### data path ########
print(jupyter_data_dir()) results in:
C:\Users\pybokeh\AppData\Roaming\jupyter

print(jupyter_path()) results in:
['d:\\.profiles\\nbextensions', 'C:\\Users\\pybokeh\\AppData\\Roaming\\jupyter', 'D:\\Miniconda3\\envs\\data_analysis\\share\\jupyter', 'D:\\ProgramData\\jupyter']

Per the docs, to ensure my extensions were installed correctly in the correct location, I executed these commands which resulted in "True":
import notebook
notebook.nbextensions.check_nbextension('usability/codefolding', user=True)
notebook.nbextensions.check_nbextension('usability/codefolding/main.js', user=True)

Then I enable the extension via:
E = notebook.nbextensions.EnableNBExtensionApp()
E.enable_nbextension('usability/codefolding/main')

As a check, I opened up the notebook.json file located at D:\.profiles\nbconfig and the contents of which are:
{
  "load_extensions": {
    "usability/codefolding/main": true
  }
}

Then I launch the notebook, but the extension is not loaded/working and I get no error messages in the terminal that I launched the jupyter notebook server from and I don't see any error messages in Firefox's developer javascript debugger tool (but I am not too familiar with javascript or web development in general) so I could be wrong about no javascript errors.  I can visit the url  http://127.0.0.1:8888/jupyter/nbextensions/usability/codefolding/main.js and see the js file.

I was told of this github issue https://github.com/jupyter/notebook/issues/250   but not sure if it applies to Windows also.  My notebook version is 4.0.1

I also tried to install the extension using the "jupyter nbextension install" command:

jupyter nbextension install usability/codefolding/main

then get the following error messages:
> copying usability/codefolding/main -> D:\ProgramData\jupyter\nbextensions\main
Traceback (most recent call last):
  File "D:\Miniconda3\envs\data_analysis\Scripts\jupyter-nbextension-script.py", line 5, in <module>
    main()
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\traitlets\config\application.py", line 592, in launch_instance
    app.start()
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\notebook\nbextensions.py", line 401, in start
    super(NBExtensionApp, self).start()
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\jupyter_core\application.py", line 256, in start
    self.subapp.start()
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\notebook\nbextensions.py", line 317, in start
    self.install_extensions()
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\notebook\nbextensions.py", line 305, in install_extensions
    nbextensions_dir=self.nbextensions_dir,
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\notebook\nbextensions.py", line 216, in install_nbextension
    _maybe_copy(src, full_dest, verbose)
  File "D:\Miniconda3\envs\data_analysis\lib\site-packages\notebook\nbextensions.py", line 53, in _maybe_copy
    shutil.copy2(src, dest)
  File "D:\Miniconda3\envs\data_analysis\lib\shutil.py", line 245, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "D:\Miniconda3\envs\data_analysis\lib\shutil.py", line 108, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'usability/codefolding/main'

What's interesting is the first line of the error message.  It is trying to copy from D:\ProgramData\jupyter\nbextensions\main, but I have set my JUPYTER_PATH to D:\.profile\nbextensions   So it appears to ignore that environment variable that I have set.  What's also interesting is that it omitted the 'usability/codefolding' directory.

My notebook version is 4.0.1  Perhaps, I should wait for version 4.1 to install extensions?

Thanks.

- Daniel

Jonathan Frederic

unread,
Sep 11, 2015, 12:04:27 PM9/11/15
to jup...@googlegroups.com
Because you see the file at http://127.0.0.1:8888/jupyter/nbextensions/usability/codefolding/main.js , the extension is installed. However, either the extension itself is broken or the mechanism that runs the Javascript is not running the Javascript. Try this:
- Open a notebook, 
- hit Ctrl-Shift-i to open dev tools, 
- click one the console tab,
- type this in `IPython.utils.load_extension('usability/codefolding/main');` (without the backticks)

If you don't see any errors and the extension works, it's a problem with the notebook frontend config.  If you don't see any errors and the extension doesn't work, then that's a pretty good indicator it's a problem with the extension.  Otherwise, please report back with the error, so we can help.

Cheers,
Jon

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/f77ba714-76df-4dcd-95cf-6a51093d3941%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pybokeh

unread,
Sep 11, 2015, 12:20:48 PM9/11/15
to Project Jupyter
Thanks.  After executing the following:  IPython.utils.load_extension('usability/codefolding/main');

It returned:

Uncaught ReferenceError: IPython is not defined
    at <anonymous>:2:1
    at Object.InjectedScript._evaluateOn (<anonymous>:904:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:837:34)
    at Object.InjectedScript.evaluate (<anonymous>:693:21)(anonymous function) @ VM61:2InjectedScript._evaluateOn @ VM60:904InjectedScript._evaluateAndWrap @ VM60:837InjectedScript.evaluate @ VM60:693
Reply all
Reply to author
Forward
0 new messages