I am trying to use custom themes with my ipython notebooks. For this purpose I have first created a new profile:
C:\>ipython profile create teststyle
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_config.py'
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_qtconsole_config.py'
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_notebook_config.py'
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_nbconvert_config.py'
Then I have replaced the "C:\Users\mayankpj.ipython\profile_teststyle\static\custom\custom.css" file with the one from here: https://github.com/nsonnad/base16-ipython-notebook
I grabbed one of the css files and renamed it to custom.css and replaced the above file with it.
Now, I launched the ipython notebook session with the above profile:
C:\>ipython notebook --profile=teststyle
2014-12-16 04:11:44.407 [NotebookApp] Using existing profile dir: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle'
2014-12-16 04:11:44.500 [NotebookApp] Serving local MathJax from C:\Users\mayankpj\.ipython\nbextensions\mathjax\MathJax.js at /nbextensions/mathjax/M
athJax.js
2014-12-16 04:11:44.828 [NotebookApp] Serving notebooks from local directory: C:\
2014-12-16 04:11:44.828 [NotebookApp] 0 active kernels
2014-12-16 04:11:44.828 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2014-12-16 04:11:44.828 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
However, when i create a new notebook, it is same as earlier. I have updated my ipython to 2.3.0 and am using pythonxy distribution on windows 8. I have installed local copy of mathjax and pandoc on my machine and can export notebooks as html and rst files.
Any help would be greatly appreciated!
EDIT: I also tried incognito mode of browser but to no avail. Also, i looked at the js console, it had the following info:
Default extension for cell metadata editing loaded.
rawcell.js:87 Raw Cell Format toolbar preset loaded.
slideshow.js:48 Slideshow extension for metadata editing loaded.
main.js:29 patching CM for undefined indent
kernel.js:124 Kernel started: 182e1a5b-8e4b-4993-a1ac-be2c97508e79
kernel.js:151 Starting WebSockets: ws://localhost:8888/api/kernels/182e1a5b-8e4b-4993-a1ac-be2c97508e79
:8888/static/components/backbone/backbone-min.map:1 GET http://localhost:8888/static/components/backbone/backbone-min.map 404 (Not Found)
:8888/static/components/underscore/underscore-min.map:1 GET http://localhost:8888/static/components/underscore/underscore-min.map 404 (Not Found)
Related
Getting error as "nbconvert failed: No suitable chromium executable found on the system. Please use '--allow-chromium-download' to allow downloading one." while trying to download jupyter notebook file (.ipynb) as a PDF file
Install and execute pyppeteer-install in your command prompt as below:
pyppeteer-install
[INFO] Starting Chromium download.
100%|█| 137M/137M
[INFO] Beginning extraction
[INFO] Chromium extracted to: C:\Users\AppData\Local\pyppeteer\pyppeteer\local-chromium\588429
Now the selected ipynb file should get extracted as a PDF while downloading with the "PDF via HTML (.pdf)" option.
I shut down all kernels and close jupyterlab in the browser, but when I open it again it starts a session, and a kernel, for all opened notebooks
I'd followed the code and found that in jupyterlab notebook code the start session function calls (POST /api/sessions) on notebook load if there is not any running kernel for the current notebook. and the API creates a session and also starts a kernel.
I can't find any config for stopping this action in jupyter configs or jupyterlab settings (settings -> advanced settings editor)
You can prevent automatically starting kernels when you open a notebook by running Jupyterlab with the jupyter lab --LabServerApp.notebook_starts_kernel=False flag.
To make the configuration permanent, you can add
c.LabServerApp.notebook_starts_kernel = False to $(jupyter --config-dir)/jupyter_lab_config.py. If this file doesn't exist yet, generate it by running jupyter lab --generate-config.
See this issue comment for more details:
https://github.com/jupyterlab/jupyterlab/issues/12019#issuecomment-1145841583
I'm working with Jupyter Notebook version 4.1.0 and can't seem to manually select the save path.
How does one manually specify where a session is saved?
You can launch jupyter notebook from the command line from inside the desired folder path. This will set the current folder as the start of the directory tree in Jupyter.
If we already have a session running, we can select the option IPython Notebook (.ipynb), from the file menu, under the Download as option. After saving the Notebook to a desired path, we can open it using the method described above.
I am running Ubuntu 14.04 in virtual box with a recent anaconda install. I installed jupyter notebooks using conda. I have followed all of the documentation that I can find online to install notebook extensions but they fail to load with the error messages listed below. The first error is from the jupyter notebook app running in a terminal and the second error is in the chrome java console. Notice that I cannot post this question with this many hyperlinks so I remove the "p" from "http" in my error messages.
[W 07:02:06.451 NotebookApp] 404 GET
/nbextensions/python-markdown.js?v=20150904070147 (127.0.0.1) 8.47ms
referer=htt://localhost:8888/notebooks/Untitled.ipynb
htt://localhost:8888/nbextensions/python-markdown.js?v=20150904070147
Failed to load resource: the server responded with a status of 404
(Not Found)
To detail my installation method: I cloned the git repository [IPython-notebook-extensions][1] and used the command jupyter-nbextension install python-markdown inside the IPython-notebook-extensions/usability/ folder. I then enabled the extension with jupyter-nbextension enable python-markdown. I ran these commands as superuser as well.
After this failed I installed this extension inside python (from the usability/ directory of the repository) using:
import notebook
notebook.install_nbextension('python-markdown',user=True)
E=notebook.nbextensions.EnableNBExtensionApp()
E.enable_nbextension('python-markdown')
I also tried this as the superuser without the parameter user=True.
I have confirmed that the files copied to both /usr/local/share/jupyter/nbextensions/python-markdown and ~/.local/share/jupyter/nbextensions/python-markdown. The extension is enabled in the ~/.jupyter/nbconfig/notebook.json file. Finally, I also deleted the chromium and mozilla cache (by deleting the folders in the ~/.cache directory) multiple times while trying this.
Solved here: https://github.com/ipython-contrib/IPython-notebook-extensions/issues/282. The ~/.jupyter/nbconfig/notebook.json file must be edited to use python-markdown/main instead of python-markdown.
More generally this kind of error can also happen after you've upgraded Jupyter/Python/etc and some of the extensions are not supported by your updates. You can then just disable them from the Nbextensions configuration tab - you may find that they're the extensions that are shown as incompatible - which can be disabled by ticking the 'disable configuration for nbextensions without explicit compatibility' checkbox.
With apologies in advance for the "I can't get it to work" question: How should I load a .py file into ipython notebook? I want to convert python code to notebooks (first simple scripts and later scripts that include nbconvert directives embedded as comments-- see bottom of the linked file.)
Perhaps I'm doing it wrong, but perhaps there's something wrong with my set-up. When I drag a .py file to the Notebook's file list, I get the message
Invalid file type: Uploaded notebooks must be .ipynb files.
I even tried changing the extension to .ipynb (keeping the python script unmodified); reasonably enough, I got an error:
Error loading notebook: Bad request
Any idea what's going wrong?
System information: I'm on OS X (10.8, Mountain Lion), using Firefox 28.0 and Anaconda 1.9.2 (x86_64), which supplies python 2.7.6 and ipython 2.0. Anaconda is not on the default PATH; I add it in a bash session from which I then launch notebook with ipython notebook, and I'm able to open and edit .ipynb files normally in the browser.
But I do get some curious behavior:
When exporting from notebook as a .py file, I don't get the control comments documented here but a simpler format, without version number:
# coding: utf-8
# In[ ]:
print "This is a slide"
## Top-level title
### Second-level heading
#### Third-level heading
# This is some `markdown` text.
#
# And some more here.
Any idea what's going on here?
The same format is generated by ipython nbconvert. However, if I start the notebook server with ipython notebook --script (which exports the notebook as a python script every time it is saved), the result contains the nbconvert directives we need to convert back to a notebook!
I had the same problem.
This post helped:
How to load/edit/run/save text files (.py) into an IPython notebook cell?
Basically, we just have to use the following command in the cell. And the .py file has to be in the same directory.
%load filename.py
I'm not sure why notebook doesn't support this natively, but I've concluded that the answer is: It can't be done from the command line or notebook GUI.
Control comments like <markdowncell> can only be interpreted by accessing notebook's API through python, as shown by #CliffordVienna in this answer to my related question.
import IPython.nbformat.current as nbf
nb = nbf.read(open('test.py', 'r'), 'py')
nbf.write(nb, open('test.ipynb', 'w'), 'ipynb')
Edit: The above method does not work with the current version (v4) of the Notebook API, so I have added this self-answer to show how it's done.
If you only need to import a local file, first use:
sys.path.append(os.getcwd())
to place the .pynb file's directory in sys.path, and then import the local file.