[IPython-User] batch convert notebooks to html files

Martin Jones martin.jones@ed.ac...
Tue Jul 24 03:12:54 CDT 2012


Thanks for the suggestions. I am trying to get nbconvert running but
get an error:

martin@martin-S5000XVN:~/nbconvert$ python ./nbconvert.py
Traceback (most recent call last):
  File "./nbconvert.py", line 38, in <module>
    from IPython.nbformat.v3.nbjson import BytesEncoder
ImportError: No module named v3.nbjson


I have ipython installed:

martin@martin-S5000XVN:~/nbconvert$ pip install ipython
Requirement already satisfied (use --upgrade to upgrade): ipython in
/usr/lib/python2.7/dist-packages
Cleaning up...

so I must be missing some other dependency, but I am not sure what it
is - any ideas?

Thanks,

Martin





On 23 July 2012 13:48,  <ipython-user-request@scipy.org> wrote:
> Send IPython-User mailing list submissions to
>         ipython-user@scipy.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.scipy.org/mailman/listinfo/ipython-user
> or, via email, send a message with subject or body 'help' to
>         ipython-user-request@scipy.org
>
> You can reach the person managing the list at
>         ipython-user-owner@scipy.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of IPython-User digest..."
>
>
> Today's Topics:
>
>    1. ipython notebook & fortran extension output (Ivan Oseledets)
>    2. Re: ipython notebook help (Darren Govoni)
>    3. Re: ipython notebook & fortran extension output (Fernando Perez)
>    4. Multiprocessing with IPython (mgi)
>    5. batch convert notebooks to html files (Martin Jones)
>    6. Re: Multiprocessing with IPython (mgi)
>    7. Re: batch convert notebooks to html files (Matthias BUSSONNIER)
>    8. Re: batch convert notebooks to html files (Dami?n Avila)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 22 Jul 2012 21:35:56 +0200
> From: Ivan Oseledets <ivan.oseledets@gmail.com>
> Subject: [IPython-User] ipython notebook & fortran extension output
> To: ipython-user@scipy.org
> Message-ID:
>         <CANSLWcR-Ar2-SWZVMgTbc0HY69oes9CW7+s3iO98vf4=t7rzKg@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello everyone.
>
> I have tried the latest stable Ipython notebook (0.13) on Mac Os X 10.6
> and it looks great. However, the output of my f2py extension is not catched by
> the notebook and is printed to the console. What is the right way to
> grab this output to the notebook?
>
> Ivan Oseledets
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 22 Jul 2012 17:06:26 -0400
> From: Darren Govoni <darren@ontrenet.com>
> Subject: Re: [IPython-User] ipython notebook help
> To: "Discussions about using IPython. http://ipython.org"
>         <ipython-user@scipy.org>
> Message-ID: <1342991186.16057.10.camel@tungsten>
> Content-Type: text/plain; charset="utf-8"
>
> Good examples. Thanks for this.
>
> But is it possible to attach remote engines to the notebook cluster?
> Or attach the notebook to a running ipcontroller?
>
> On Thu, 2012-07-19 at 20:50 -0500, MinRK wrote:
>
>>
>>
>>
>> On Thu, Jul 19, 2012 at 6:03 PM, Darren Govoni <darren@ontrenet.com>
>> wrote:
>>
>>         Do any of the image processing cells in your image notebook
>>         (which is great help btw!) implicitly leverage
>>         ipython's parallel flows at all?
>>
>>
>>
>> Nope.  It's just a transcript of a demo doing basic work with images
>> in numpy, matplotlib, and PIL.
>>
>>
>> The parallel code is not terribly hidden or implicit, so it should be
>> apparent when it is in use.
>>
>>
>> For that, you should check out our tutorial notebooks from the
>> presentation this week.
>>
>>
>>         On Wed, 2012-07-18 at 16:49 -0500, MinRK wrote:
>>
>>         >
>>         >
>>         > On Wed, Jul 18, 2012 at 4:12 PM, Thomas Kluyver
>>         > <takowl@gmail.com> wrote:
>>         >
>>         >         Hi Darren,
>>         >
>>         >         On 18 July 2012 22:01, Darren Govoni
>>         >         <darren@ontrenet.com> wrote:
>>         >         > 1) Is there a thorough tutorial on notebook? From
>>         >         hello world to the UI
>>         >         > features?
>>         >
>>         >
>>         >         There's a folder of example notebooks, including an
>>         >         introduction one.
>>         >         They may have come with your installation, depending
>>         >         on where you got
>>         >         it from, or you can get them here:
>>         >         https://github.com/ipython/ipython/tree/master/docs/examples/notebooks
>>         >
>>         >         > 2) I want to do some image processing with it. Is
>>         >         there an example (or is it possible) > to interact
>>         >         with image data? e.g. run some ipython code,
>>         >         return/display the image result?
>>         >
>>         >
>>         >         It's certainly possible, although I don't know if
>>         >         there's an example
>>         >         yet. For simple cases, matplotlib has imread() and
>>         >         imshow() functions.
>>         >         Working with PIL might need a little integration,
>>         >         but hopefully just a
>>         >         few extra lines.
>>         >
>>         >
>>         >
>>         > Here is a notebook I made while trying to follow along with
>>         > one of Fernando's Py4Science tutorials, which covered
>>         > working with image data:
>>         >
>>         >
>>         > https://gist.github.com/3139142
>>         >
>>         >
>>         > It includes the code for automatically displaying PIL
>>         > objects as images in the notebook, which I added later:
>>         >
>>         >
>>         > from io import BytesIO
>>         >
>>         >
>>         > def display_image(img, format='PNG'):
>>         >     fp = BytesIO()
>>         >     img.save(fp, format=format)
>>         >     return fp.getvalue()
>>         >
>>         >
>>         > ip = get_ipython()
>>         > png_formatter = ip.display_formatter.formatters['image/png']
>>         > png_formatter.for_type_by_name('Image', 'Image',
>>         > display_image)
>>         >
>>         >
>>         > which we might want to have on by default.
>>         >
>>         >
>>         > -MinRK
>>         >
>>         >
>>         >
>>         >
>>         >
>>         >         Best wishes,
>>         >         Thomas
>>         >         _______________________________________________
>>         >         IPython-User mailing list
>>         >         IPython-User@scipy.org
>>         >         http://mail.scipy.org/mailman/listinfo/ipython-user
>>         >
>>         >
>>         >
>>         >
>>         > _______________________________________________
>>         > IPython-User mailing list
>>         > IPython-User@scipy.org
>>         > http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>>
>>
>>
>>
>>         _______________________________________________
>>         IPython-User mailing list
>>         IPython-User@scipy.org
>>         http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>>
>>
>>
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120722/b6c32229/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Sun, 22 Jul 2012 20:24:32 -0700
> From: Fernando Perez <fperez.net@gmail.com>
> Subject: Re: [IPython-User] ipython notebook & fortran extension
>         output
> To: "Discussions about using IPython. http://ipython.org"
>         <ipython-user@scipy.org>
> Message-ID:
>         <CAHAreOrOfsKNS7kpAO0iBfyAPTn7pYw1-Tx=SocRoMyn4BEiOQ@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Sun, Jul 22, 2012 at 12:35 PM, Ivan Oseledets
> <ivan.oseledets@gmail.com> wrote:
>>
>> I have tried the latest stable Ipython notebook (0.13) on Mac Os X 10.6
>> and it looks great. However, the output of my f2py extension is not catched by
>> the notebook and is printed to the console. What is the right way to
>> grab this output to the notebook?
>
> We can only capture what goes to sys.stdout, and raw C/fortran
> printing bypasses this completely.  If you google in the archives of
> the ipython mailing lists, years ago there were some threads with
> Robert Kern and Hans Meine where some approaches for capturing
> extension code output were proposed.  You could try one of those
> ideas, and if you find a robust solution by all means contribute it
> back (either as a recipe for doing it manually or as an improvement to
> IPython itself if it can be automated).
>
> Cheers,
>
> f
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 23 Jul 2012 00:37:42 -0700 (PDT)
> From: mgi <miles.izzo@dataprocessors.com.au>
> Subject: [IPython-User] Multiprocessing with IPython
> To: ipython-user@scipy.org
> Message-ID: <1343029062221-4982825.post@n6.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I have seen multiple issues in the past about using IPython in multiple
> processes, but I'm not sure that this exact issue has been addressed.
> Perhaps I'm doing something fundamentally wrong, in which case it would also
> be great to know!
>
> I'm starting a controller on a machine using:
> ipcontroller --ip=10.21.21.188 --port=1024
>
> Then connecting a couple of engines on different machines using:
> ipengine
>
> They are operating under an NFS share, so the home directories are shared
> (hence the engines can find the JSON settings from the default profile). The
> connections seem to succeed.
>
> Given the code pasted here: http://pastebin.com/3ezLnJZP
>
> I get the following output:
> There are 2 engines.
> Assertion failed: ok (mailbox.cpp:84)
> Aborted
>
> ..followed by this stacktrace (after the process has already spat me back to
> bash):
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in
> _bootstrap
>     self.run()
>   File "test_multiproc.py", line 9, in run
>     my_client = Client()
>   File "/usr/lib/python2.7/dist-packages/IPython/parallel/client/client.py",
> line 387, in __init__
>     self._connect(sshserver, ssh_kwargs, timeout)
>   File "/usr/lib/python2.7/dist-packages/IPython/parallel/client/client.py",
> line 491, in _connect
>     raise error.TimeoutError("Hub connection request timed out")
> TimeoutError: Hub connection request timed out
>
> What am I doing wrong? Note that there are no problems with the connection
> if I do everything in sub-processes, or everything in the main process (as
> in, I can execute code on the engines from that script).
>
> Some other details: I'm running Ubuntu 12.04 (precise) amd64, Python 2.7.3,
> IPython 0.12.1, 0MQ 2.2.0 (also tried 2.1.11).
>
>
>
> --
> View this message in context: http://python.6.n6.nabble.com/Multiprocessing-with-IPython-tp4982825.html
> Sent from the IPython - User mailing list archive at Nabble.com.
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 23 Jul 2012 09:10:22 +0100
> From: Martin Jones <martin.jones@ed.ac.uk>
> Subject: [IPython-User] batch convert notebooks to html files
> To: ipython-user@scipy.org
> Message-ID:
>         <CAJ-Fwh2CMkyPJzAQqEqNNqSMgJip2EZHEF8ToYmiTrLLqnSCbA@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> I have just finished using iPython to teach a couple of Python
> courses, and I would like to convert all my notebooks (I have 20 of
> them) to html (Print view) in order to put them up on a web server. Is
> there any way of doing this in a semi-automated fashion, i.e. could I
> write a bash/python script to do the conversion from the command line?
> I know that I could just open each notebook in a web browser, get the
> print view, then save it, but I am trying to come up with a way that I
> can rebuild all the web pages if I make a change to a notebook.
>
> Thanks,
>
> Martin
>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 23 Jul 2012 01:11:39 -0700 (PDT)
> From: mgi <miles.izzo@dataprocessors.com.au>
> Subject: Re: [IPython-User] Multiprocessing with IPython
> To: ipython-user@scipy.org
> Message-ID: <1343031099827-4982828.post@n6.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
> For what it's worth, I managed to get around this error by initialising the
> Client with a fresh zmq context. Basically, I replaced:
>
> client = Client()
>
> with:
>
> import zmq
> client = Client(context=zmq.Context())
>
> Not sure if this is a valid approach, but it seemed to work!
>
>
>
> --
> View this message in context: http://python.6.n6.nabble.com/Multiprocessing-with-IPython-tp4982825p4982828.html
> Sent from the IPython - User mailing list archive at Nabble.com.
>
>
> ------------------------------
>
> Message: 7
> Date: Mon, 23 Jul 2012 10:25:41 +0200
> From: Matthias BUSSONNIER <bussonniermatthias@gmail.com>
> Subject: Re: [IPython-User] batch convert notebooks to html files
> To: "Discussions about using IPython. http://ipython.org"
>         <ipython-user@scipy.org>
> Message-ID: <2C209B63-FEEF-4D2E-9640-34A19B9D734E@gmail.com>
> Content-Type: text/plain; charset=windows-1252
>
>
> Le 23 juil. 2012 ? 10:10, Martin Jones a ?crit :
>
>> Hi,
>>
>> I have just finished using iPython to teach a couple of Python
>> courses, and I would like to convert all my notebooks (I have 20 of
>> them) to html (Print view) in order to put them up on a web server. Is
>> there any way of doing this in a semi-automated fashion, i.e. could I
>> write a bash/python script to do the conversion from the command line?
>> I know that I could just open each notebook in a web browser, get the
>> print view, then save it, but I am trying to come up with a way that I
>> can rebuild all the web pages if I make a change to a notebook.
>
> You could take a look at nbconvert :
> https://github.com/ipython/nbconvert
>
> We will be happy to get any feedback and pull request.
> Once ready it should be merged with the main IPython repository.
>
> It also allows you to export as pdf, latex, markdown?
>
> We'll also be happy to get any feedback on how your teaching was, and if you have any suggestion.
> --
> Matthias
>
> ------------------------------
>
> Message: 8
> Date: Mon, 23 Jul 2012 09:52:13 -0300
> From: Dami?n Avila <damianavila@gmail.com>
> Subject: Re: [IPython-User] batch convert notebooks to html files
> To: ipython-user@scipy.org
> Message-ID: <500D48FD.4040409@gmail.com>
> Content-Type: text/plain; charset="windows-1252"
>
> El 23/07/12 05:25, Matthias BUSSONNIER escribi?:
>> Le 23 juil. 2012 ? 10:10, Martin Jones a ?crit :
>>
>>> Hi,
>>>
>>> I have just finished using iPython to teach a couple of Python
>>> courses, and I would like to convert all my notebooks (I have 20 of
>>> them) to html (Print view) in order to put them up on a web server. Is
>>> there any way of doing this in a semi-automated fashion, i.e. could I
>>> write a bash/python script to do the conversion from the command line?
>>> I know that I could just open each notebook in a web browser, get the
>>> print view, then save it, but I am trying to come up with a way that I
>>> can rebuild all the web pages if I make a change to a notebook.
>> You could take a look at nbconvert :
>> https://github.com/ipython/nbconvert
>>
>> We will be happy to get any feedback and pull request.
>> Once ready it should be merged with the main IPython repository.
>>
>> It also allows you to export as pdf, latex, markdown?
>>
>> We'll also be happy to get any feedback on how your teaching was, and if you have any suggestion.
>
> You also can use vIPer to do the html conversion:
> http://www.viperapp.oquanta.info <http://www.viperapp.oquanta.info/>
> vIPer is currently in alpha but it is functional... You can see an
> example here: http://www.staticviper.oquanta.info
> <http://www.staticviper.oquanta.info/>
>
> Regards.
>
> Dami?n.
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120723/0f085e95/attachment.html
>
> ------------------------------
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
> End of IPython-User Digest, Vol 105, Issue 39
> *********************************************
>


More information about the IPython-User mailing list