Comments (26)
I got the TOC extension to work in IPython 4 / Jupyter.
It wasn't working following the provided installation instructions, giving the following error in the javascript console:
Loaded extension: toc
Uncaught TypeError: Cannot read property 'load_ipython_extension' of undefined
However, when I moved the toc.js
and toc.css
files to the .jupyter/data/nbextensions/usability/toc
folder, and added a line "usability/toc/toc": true
to the .jupyter/nbconfig/notebook.json
file, everything worked!
Here are the complete instructions:
-
Set
JUPYTER_CONFIG_DIR
andJUPYTER_DATA_DIR
environmental variables in~/.bashrc
, so that there are no surprises:export JUPYTER_CONFIG_DIR=$HOME/.jupyter export JUPYTER_DATA_DIR=$HOME/.jupyter/data
-
Install nbextensions by cloning the git repository and running
python setup.py install
. -
Open a notebook using
jupyter notebook
, and activate some nbextensions by navigating to thehttp://localhost:8888/nbextensions/
page. This should create annotebook.json
file in your$JUPYTER_CONFIG_DIR/nbconfig/
directory. -
Move
toc.js
andtoc.css
files to the$JUPYTER_DATA_DIR/nbextensions/usability/toc
folder, and add a line"usability/toc/toc": true
to yournotebook.json
file.
Restart your notebook, and everything should work!
from ipython_extensions.
same with me on anaconda.
but with the following change in custom.js it works:
$([IPython.events]).on("notebook_loaded.Notebook", function () {
IPython.load_extensions("toc");
});
from ipython_extensions.
@dacoex Thanks for the suggestion, but that still doesn't do anything for me. :L
from ipython_extensions.
Hey @diego898,
I am having a similar issue and the javascript is throwing an odd error. In the function toc_button
I get an uncaught type error which states "cannot read property 'toolbar' of type undefined." This is called by load_ipython_extension
in toc.js which is the entry point from utils.js.
Hopefully this points to the problem source.
Cheers, Matt
from ipython_extensions.
I think it depends on the IPython version which mode of loading you choose.
from ipython_extensions.
@dacoex I've tried both methods: the one in the readme and hte one you suggested with ipython version: 2.3.1 and I couldnt anything to show up.
from ipython_extensions.
This extension only works with IPython 3.x
from ipython_extensions.
@minrk - I am using 3.4 and still have the same error...
from ipython_extensions.
IPython version 3.x, not Python 3. There is no IPython 3.4 yet.
from ipython_extensions.
Is there an archived version of the TOC extension that works for IPython 2.3.x (or 2.4.x)?
It used to work fine for me on my anaconda distribution, but has now stopped working. It's a great extension and I'm really missing it :-(
from ipython_extensions.
same here.
from ipython_extensions.
Thanks, @minrk.... I was looking a the python distribution, not the ipython version. I am going to second @dreme - I can not seem to upgrade to the current development version of ipython (Window's 8).
from ipython_extensions.
The 2.x branch of this repo marks the last commit before 3.x changes started happening. There may have been fixes since then that aren't backported.
https://github.com/minrk/ipython_extensions/tree/2.x
If you have fixes for 2.x, feel free to make PRs against that branch.
from ipython_extensions.
thanks @minrk !
The following works for me:
curl https://raw.githubusercontent.com/minrk/ipython_extensions/2.x/nbextensions/toc.js > $(ipython locate)/nbextensions/toc.js
curl https://raw.githubusercontent.com/minrk/ipython_extensions/2.x/nbextensions/toc.css > $(ipython locate)/nbextensions/toc.css
and IPython.load_extensions('toc');
in my custom.js
from ipython_extensions.
Thanks minrk for the pointer to the 2.x branch, and good to see that it works for diego.
Sadly, it is still not working for me. Can I check with you guys that I'm putting the appropriate files in the right folders. I have an anaconda python distro on windows 7 and my .ipython folder sits in my home folder:
- 2.x versions of toc.css and toc.js files in the .ipython/nbextensions folder
- custom.js file (with dacoex's suggested loading script) in the .ipython\profile_default\static\custom folder
I'm having the same problem in Chrome and Firefox, so don't think it is browser related.
from ipython_extensions.
I have anaconda on windows 8. My custom.js
is in:
I have IPython.load_extensions('toc');
in: C:\Users\diego\.ipython\profile_default\static\custom\custom.js
Some notes:
- make sure you used the commands I pasted above to make sure you're grabbing the 2.x versions.
- after installing them, I shut down ipython, restarted chrome and restarted ipython
from ipython_extensions.
Thanks Diego, I've just been doing a 'copy and paste' from minrk's github pages to get the toc.css and toc.js scripts.
How did you execute the curl command in Windows, as it doesn't work in the windows cmd shell
from ipython_extensions.
I ran it using git bash. You can also just download them using these links:
https://raw.githubusercontent.com/minrk/ipython_extensions/2.x/nbextensions/toc.js
https://raw.githubusercontent.com/minrk/ipython_extensions/2.x/nbextensions/toc.css
and place them manually in: C:\Users\YOURNAME\.ipython\nbextensions\
from ipython_extensions.
Thanks Diego.
I've used Git Shell to execute the curl commands for downloading the 2.x toc.css and toc.js files, and put them in the nbextensions folder, and also updated my custom.js file. I also shut down the ipython notebook server and my browser.
But unfortunately the TOC extension still doesn't load.
I'll try rebooting my computer to see if that helps ...
from ipython_extensions.
Nope, the reboot didn't work. Dang, this is frustrating ...
from ipython_extensions.
Hello! @minrk unexpectedly this problem reappeared for me today, even though it was working for me after I upgraded to ipython 3.x
It was working fine, but today it wont load anymore though I have all the files in place and have placed the loading snippet in custom.js
EDIT: restarting ipython+chrome wasnt enough. I had to restart the computer then the TOC appeared.
from ipython_extensions.
@ostrokach I don't have a ~/.jupyter/data directory!
from ipython_extensions.
@diego898 The default JUPYTER_DATA_DIR
is platform specific. You can see what it is on your system using the command:
python -c "from jupyter_core.paths import jupyter_data_dir; print(jupyter_data_dir());"
You can change it to whatever you like by exporting the JUPYTER_DATA_DIR
environment variable. I saw someone else doing export JUPYTER_DATA_DIR=$JUPYTER_CONFIG_DIR/data
in their ~/.bashrc, and I liked that idea because it's much more consistent with how IPython did things.
Either way, that folder may be empty until you install nbextensions.
For more info, see here: http://jupyter-core.readthedocs.org/en/latest/paths.html.
from ipython_extensions.
Hi @ostrokach, thanks for your instructions on getting the TOC extension to work in IPython 4 / Jupyter
I'm trying to apply them for a Win7 python anaconda installation. Unfortunately I get stuck on your first instruction for installing nbextensions, using:
conda install -c http://conda.anaconda.org/juhasch nbextensions
Unfortunately this leads to the following error:
Fetching package metadata: ......
Solving package specifications: .............
Error: Unsatisfiable package specifications.
Generating hint:
Hint: the following packages conflict with each other:
- nbextensions
- python 2.7*
Use 'conda info nbextensions' etc. to see the dependencies for each package.
Note that the following features are enabled:
- vc9
Any ideas?
from ipython_extensions.
Hey @dreme,
You are getting that error because you are using Python 2.7 and the juhasch
anaconda channel has nbextension binaries only for Python 3.4 (see https://anaconda.org/juhasch/nbextensions/files).
You should download nbextensions from github (press the Download ZIP
button, or clone the repository using git), and install it by typing python setup.py install
.
I never use windows so can't give you more help than that.
from ipython_extensions.
Hi @ostrokach, thank you very much. I now have the TOC extension working, along with a whole heap of other goodies in the notebook extension package that you kindly referred me to
from ipython_extensions.
Related Issues (20)
- Gist button: problem grabbing notebook JSON code HOT 3
- ToC does not update on cell execution HOT 2
- ToC magic does not work in IPython 3.0 HOT 3
- TypeError: IPython is undefined toc.js:136:8 HOT 3
- Two install instructions for ToC HOT 1
- Load timeout for modules HOT 3
- contribute the nbextensions (at least toc) to ipython-contrib/IPython-notebook-extensions HOT 6
- Jupyter notebook 4 hangs with TOC extension HOT 8
- How can I contribute to the table of content extension?
- feature request: show/hide table of contents with a shortcut HOT 1
- Typo in TOC install commands
- Duplicates entries after each save/refresh HOT 1
- floating TOC is too small
- string including "] will cause In[*] problem
- Question: Will some of the extensions, like ToC, gist work w/ custom kernels? HOT 2
- install renumber-button via URL?
- Error on install HOT 1
- making margin width configurable
- Headings for TOC no more supported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipython_extensions.