Francesc Alted | 16 Jul 20:22 2015

Way to retrieve the value of %time?


I am trying to come up with a way of accessing the time measured by the magic %time.  That is, in:

In [149]: %time sum(i for i in xrange(1000000))
CPU times: user 118 ms, sys: 27.4 ms, total: 145 ms
Wall time: 121 ms
Out[149]: 499999500000

is there a way to get the 121 ms value of the 'Wall time' above and put that in a variable?  I know I can use something like:

In [150]: from time import time

In [151]: t0 = time(); sum(i for i in xrange(1000000)); mytime = time() - t0

In [152]: mytime
Out[152]: 0.10076594352722168

but %time is so much convenient, specially for tutorials, that I would rather prefer using it.


Francesc Alted
IPython-User mailing list
IPython-User <at>
Kudeki, Erhan | 13 Jul 23:36 2015

jupyter Text File editor language feature

Please make the Text File editor of ipython notebook or jupyter recognize *.ipy files
for automatic python language formatting as it does for *.py files.


Erhan Kudeki                   Tel: 217 265 0128     erhan <at>
Professor and Associate Head for Undergraduate Affairs
Department of Electrical and Computer Engineering
University of Illinois at Urbana-Champaign
2080 ECEB, 306 N. Wright St., Urbana, IL 61801               

IPython-User mailing list
IPython-User <at>
steve_geo | 9 Jul 01:29 2015

Markup from file


I'm just a new user to ipython notebook, and dont know if I am overlooking functionality.

I would like to store a markdown file in a directory with my data from a test run, when I open a notebook and point it at the directory with my data, I would like to see the markdown file marked up in my notebook. ( This file will specify some of the test run parameters that can change from run to run and intended for human consumption in the form of some headings and bullet points)

To do this I think I either need to be able to pass a filename to  a markdown cell.
Do it in a code cell with something like IPython.display "Markdown" object which I dont think exists.

Currently I am using John Gruber's Markdown module to read the markdown file, convert it to a html  file, then display that with IPython.display HTML, however I'd like to acheive my goal without pulling in libraries external to ipython, as it makes my notebook less portable.

Is there a better way to display the "markup" from a markdown file in a cell?

Email sent using Optus Webmail
IPython-User mailing list
IPython-User <at>
Jean-Luc Stevens | 7 Jul 01:17 2015

ANN: HoloViews 1.3 released

We are pleased to announce the fourth public release of HoloViews,
a Python package for simplifying the exploration of scientific data:

HoloViews provides composable, sliceable, declarative data
structures for building even complex visualizations easily.
The goal of HoloViews is to let your data just visualize itself,
allowing you to work with large datasets as easily as you work
with simple datatypes at the Python prompt.

You can obtain the new version using conda or pip:

   conda install -c ioam holoviews

   pip install --upgrade 'holoviews[recommended]'

This release includes a substantial number of new features and
API improvements, most of which have been suggested by our growing

- Major optimizations throughout, both for working with HoloViews
   data structures and for visualization.

- Improved widget appearance and greatly reduced flickering
   issues when interactively exploring data in the browser.

- Improved handling of unicode and LaTeX text throughout,
   using Python 3's better unicode support (when available).

- New Polygons, ErrorBars, and Spread Element types.

- Support for multiple matplotlib backends (vanilla matplotlib, mpld3
   and nbagg) with support for other plotting systems (such as Bokeh)
   in development. Easily switching between backends allows you to take
   advantage of the unique features of each one, such as good SVG/PDF
   output, interactive zooming and panning, or 3D viewpoint control.

- Streamlined the API based on user feedback; now even more things
   "just work". This includes new, easy to use constructors for
   common Element types as well as easy conversion between them.

- More customizability of plot and style options, including easier
   control over font sizes, legend positions, background color, and
   multiple color bars. Polar projections now supported throughout.

- More flexible and customizable Layouts, allowing the user to
   define blank spaces (using the Empty object) as well as more
   control over positioning and aspect ratios.

- Support for a holoviews.rc file, integration with IPython Notebook
   interact widgets, improvements to the Pandas interface, easy
   saving and loading of data via pickling, and much more.

And of course we have fixed a number of bugs found by our very
dedicated users; please keep filing Github issues if you find any!

For the full list of changes, see:

HoloViews remains freely available under a BSD license, is Python 2
and 3 compatible, and has minimal external dependencies, making it
easy to integrate into your workflow. Try out the extensive tutorials
at today, and check out our upcoming SciPy and EuroSciPy
talks in Austin and Cambridge (or read the paper at!

Philipp Rudiger
Jean-Luc R. Stevens
James A. Bednar

The University of Edinburgh
School of Informatics


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
Charles Fox | 24 Jun 14:42 2015

Fast jump to error lines?

Hi all,

I just joined this list to ask a question that's been bugging me for ages, I wonder if anyone has any suggestions:

I'd like to optimize my IPython workflow some more.   I work in IPython and vim, using "ed" to enter Vim for ipython.   When my program dies I see the backtrace, make a mental note of the file and line number of the error, type "ed <filename>" then use ":" in vim to jump to the error line.   I'd like to reduce the cognitive load here by defining an ipython command that does this automatically.   So when I see the backtrace, I type a command and it opens vim with the right file and error line.

I think like most iPython users, doing this debuging dance takes up a significant portion of my day, so it seems worth automating.   But it seems strange that no-one has already built this yet -- is there some reason  for that?   Maybe some feature already exists to do this that I don't yet know about?   Or is there a technical problem to build it?

Is anyone else wanting a tool like this?

I looked at IPython internals just a little bit to tweak the debugger displays before, but I'm not sure where this feature would live, or how to access the backtrace text from the ipython console programatically.   I'd want to parse out the filename and line number than open vim with "+<linenumber>", from within IPython code.  Any suggestions could be really useful?   Could it be done as a magic or does it need changes to IPython code itself?

IPython-User mailing list
IPython-User <at>
triccare | 11 May 16:10 2015

How to flag code cells to not execute


Often I find myself trying a number of things, creating many, many code
cells. Eventually, I get a set of code cells that do what I want.

However, I do not want to delete the less-desirable code cells, either to
remember what was tried, or provide alternate methods.  But, on reloading
the notebook and/or re-running all the cells, it would be great to be able
to flag these cells to not execute.

Changing the cell type will loose the code formatting. I want the cells to
remain code cells, just not actually execute the code.

Is there a way to get the above? And if not, this would be a feature

Thank you for your time,

View this message in context:
Sent from the IPython - User mailing list archive at
Emanuele Olivetti | 4 May 16:27 2015

Issues with IPython and emacs (in ubuntu 14.04)


I recently upgraded my laptop from Ubuntu 12.04 LTS to 14.04 LTS. As a
consequence, IPython was upgraded from v0.12.1 to v1.2.1. I am very happy
with the more recent IPython, but I am also experiencing a number of
issues with its use within emacs, both v23 and v24, like: "py-execute-buffer"
(C-c C-c) not working, "py-execute-region" (C-c |) not working, TAB-completion
not working, among others.
With IPython v.0.12.1 everything was working well within emacs.

I followed these instructions on the IPython website:
and removed all my emacs customizations in order to understand where the
issue is. My .emacs is now just
   (require 'ipython)
as suggested there. Notice that the python-mode package shipped with
Ubuntu 14.04 is v6.1.3, which should be recent enough.

I also tried the instructions for the more recent IPtyhon v3.x:
Which boil down to:
   (require 'python)
   (setq python-shell-interpreter "ipython")
Still no luck.

I then upgraded python-mode.el with the most recent one (dev, i.e >v0.6.2.0)
available from here:
and many issues disappeared with the following .emacs:
   (add-to-list 'load-path "/PATH_TO/python-mode/")
   (setq py-install-directory "/PATH_TO/python-mode/")
   (require 'ipython)
   (setq python-shell-interpreter "ipython")
   (require 'python-mode)

Still "py-execute-region" (C-c |) is not working, with different output in
emacs v24 ("Indentation error") vs. emacs v23 (hangs).

What is your working set-up for emacs and IPython? Is there a way to make
it work well as it was before?


Anton Shatenfeld | 25 Apr 08:06 2015

Key "b" does not work


For some reason I can't use "b" key in iPython, when I press "b" it does not appear in the input, but it makes a noise like a bell character, on the other hand "B" (Shift + "b") works fine.

I use:
OS X 10.10.3
Darwin Kernel Version 14.3.0
Terminal Version 2.5.3 (343.7)
Python 3.4.2 and Python 2.7.6
IPython 3.1.0

The regular Python shell works fine.

IPython-User mailing list
IPython-User <at>
Stefan Urbanek | 24 Apr 23:34 2015

Passing authenticated per-user identity to the server


We are running the iPython server (built-in server) to which multiple users are being connected. The users are connecting to a database using SQLAlchemy. We want every user to connect to the database using his own credentials – we don't want to store the connection URL in the notebook. We can put the proper authorization into our library that the user will use in the notebook: special password, host based authorization, ... does not matter, the library can take care of that. However, we need to pass the information about the user (username, id, key, ...) to the library through the server. Something like this:

    from ourdblib import connect

    connnection = connect()

the connect() should get the user credentials for that particular user-browser session somehow (environment variable, python object, notebook variable, ...) . We can provide our own authentication, we can even have a front-end that can pass wsgi params or something, we just need to be able to pass the user's identity to the notebook server so it can be passed to the library.

In other words: if I'm using ipython notebook on the server, I want the server know about me. We can have our own tools to verify me and pass my identity to the server. What is the way to pass this information to the server?

How can we do that?


I brew data.

Twitter: <at> Stiivi

IPython-User mailing list
IPython-User <at>
Mike Sam | 20 Apr 20:00 2015

Long running notebooks

What is the best way to run long running (few hours) notebooks where you can close the laptop and come back to a running notebook and sync back to where things are?

IPython-User mailing list
IPython-User <at>
Rob Clewley | 19 Apr 02:14 2015

ipython notebook config options ignored unless placed in regular config file


I'm using OS X 10.6.8 with ipython that I upgraded from v1 (from fink)
to 3.0.0 (using pip). Everything seems to work fine, except an issue
with configuration.

>From the documentation and my own testing, I am having trouble
understanding the expected behavior of config options in my
.ipython/profile_default/ versus the

I want to auto-load a couple of extensions and modules for my
notebooks but not for my regular ipython sessions (partly because
those loads create warnings, but it just seems that I'm supposed to be
able to keep these configurations separate). It seemed to make sense
that config options that apply only to the notebook go in the notebook
config. But I can only get the notebook to honour my choices when I
put the options in It seems to ignore the notebook
config, and I am stuck with non-notebook ipython also loading these
modules. Am I doing something wrong?

The documentation does not explicitly address the distinctions, and
the inline comments in these files do not make reference to the
distinction between these two config files, only to inheritance of
TerminalIPythonApp from Application and InteractiveShellApp (but same
class names in both config files). What is the rule for notebook
config reading? Does ipython read from one first, then the other?
Currently, it seems to ignore the
altogether, so why is it there?

Maybe it's related to this from 2013:
But the commit that fixed his problem is in the master repo now, so
maybe not...

The result of ipython notebook --debug is

[D 10:37:52.595 NotebookApp] Config changed:
[D 10:37:52.595 NotebookApp] {'NotebookApp': {'log_level': 10}}
[D 10:37:52.596 NotebookApp] IPYTHONDIR set to: /Users/robclewley/.ipython
[I 10:37:52.598 NotebookApp] Using existing profile dir:
[D 10:37:52.598 NotebookApp] Searching path
'/usr/local/etc/ipython', '/etc/ipython'] for config files
[D 10:37:52.598 NotebookApp] Attempting to load config file:
[D 10:37:52.600 NotebookApp] Loaded config file:
[D 10:37:52.601 NotebookApp] Config changed:
[D 10:37:52.601 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'TerminalIPythonApp':
{'matplotlib': 'osx'}}
[D 10:37:52.602 NotebookApp] Attempting to load config file:
[D 10:37:52.604 NotebookApp] Loaded config file:
[D 10:37:52.605 NotebookApp] Config changed:
[D 10:37:52.605 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp':
{'exec_lines': ['import notebook_importing'], 'gui': 'osx', 'pylab':
'osx', 'matplotlib': 'osx', 'extensions': ['yaml_magic',
'autoreload'], 'extra_extension': 'yaml_magic'}, 'TerminalIPythonApp':
{'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic'],
'matplotlib': 'osx'}}
[D 10:37:52.611 NotebookApp] searching for local mathjax in
[D 10:37:52.613 NotebookApp] searching for local mathjax in
[I 10:37:52.613 NotebookApp] Using MathJax from CDN:

For instance, invoking the magic command %%yaml (from my custom
extension) in the notebook results in a complaint that the command is
not recognized. If, instead, I set these extensions to be loaded in, then the notebook accepts %%yaml immediately. In
this case, the debug output is:

[D 10:46:50.330 NotebookApp] Config changed:
[D 10:46:50.330 NotebookApp] {'NotebookApp': {'log_level': 10}}
[D 10:46:50.331 NotebookApp] IPYTHONDIR set to: /Users/robclewley/.ipython
[I 10:46:50.332 NotebookApp] Using existing profile dir:
[D 10:46:50.332 NotebookApp] Searching path
'/usr/local/etc/ipython', '/etc/ipython'] for config files
[D 10:46:50.332 NotebookApp] Attempting to load config file:
[D 10:46:50.335 NotebookApp] Loaded config file:
[D 10:46:50.336 NotebookApp] Config changed:
[D 10:46:50.337 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp':
{'extensions': ['yaml_magic', 'autoreload']}, 'TerminalIPythonApp':
{'matplotlib': 'osx'}}
[D 10:46:50.337 NotebookApp] Attempting to load config file:
[D 10:46:50.338 NotebookApp] Loaded config file:
[D 10:46:50.339 NotebookApp] Config changed:
[D 10:46:50.340 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp':
{'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic',
'autoreload'], 'exec_lines': ['import notebook_importing'], 'gui':
'osx', 'pylab': 'osx', 'matplotlib': 'osx'}, 'TerminalIPythonApp':
{'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic'],
'matplotlib': 'osx'}}
[D 10:46:50.345 NotebookApp] searching for local mathjax in
[D 10:46:50.345 NotebookApp] searching for local mathjax in