Jupyter Notebook vs JupyterLite

There seems to be some confusion for readers of   Algorithms for Dummies, 2nd EditionBeginning Programming with Python For Dummies, 3rd Edition, Machine Learning for Dummies, 2nd EditionPython for Data Science for Dummies, and Machine Learning Security Principles lately due to the similarity of names of two Integrated Development Environments (IDEs) available now. Even though I’m sure that JupyterLite is a very good product, even the website states, “Not all the usual features available in JupyterLab and the Classic Notebook will work with JupyterLite, but many already do!” This lack of support becomes a problem when you try to run the downloadable source using JupyterLite. In addition, Luca and I haven’t tested the downloadable source with this product, so we can’t even tell you what will and won’t work.

The two supported IDEs for our books are Google Colab (recommended for those of you who want to use a mobile device) and Jupyter Notebook (recommended for those of you who have a desktop system). It’s actually preferred that you get Jupyter Notebook as part of the Anaconda toolset because Anaconda makes it very easy for you to perform some advanced setup tasks found in some of our books. For example, you gain access to the Anaconda prompt and the associated Conda utility that definitely makes it easier for you to manage some of the machine learning packages found in our books. Using either Google Colab or Jupyter Notebook makes it very much easier for Luca and I to help you with your book-specific questions.

Please let me know if you have any questions or concerns about how to setup your programming environment for our books at [email protected]. Remember to use the version of the products listed in the book for optimal results in working with the downloadable source. In addition, always remember to use the downloadable source to enhance your learning experience.

IPython Magic Functions

This is an update of a post that originally appeared on April 25, 2016.

All of my current Python language books (and those I collaborated on with Luca Massaron): Machine Learning Security Principles, Algorithms for Dummies, 2nd Edition, Beginning Programming with Python For Dummies, 3rd Edition, Python for Data Science for Dummies, and Machine Learning for Dummies, 2nd Edition allow use of Jupyter Notebook (through Anaconda) or Google Colab to interact with the example code. Both of these IDEs extend the development environment in a number of ways, one of which is the use of magic functions. You see the magic functions in the code of these books as calls that begin with either one or two percent signs (% or %%). The most common of these magic functions is %matplotlib, which controls how IPython Notebook or Jupyter Notebook display plot output from the code.

You can find a listing of the most common magic functions in the Python for Data Science for Dummies Cheat Sheet. None of my books use any other magic functions, so this is also a complete list of magic functions that you can expect to find in our books. However, you might want to know more. Fortunately, the site at https://damontallen.github.io/IPython-quick-ref-sheets/ provides you with a complete listing of the magic commands (and a wealth of other information about Jupyter Notebook).

There are differences in magic function support between Jupyter Notebook and Google Colab, some of which are outlined in our books as needed. None of these differences will significantly affect your learning experience. However, it pays to know that Jupyter Notebook and Google Colab are only mostly the same, not precisely the same, and you’ll encounter differences. The screenshots in my books reflect the Jupyter Notebook version supported by that book, so what you might see on your screen when using magic functions in Google Colab may differ from the book.

Of course, you might choose to use another IDE—one that isn’t quite so magical as Jupyter Notebook or Google Colab. In this case, you need to remove those magic commands. Removing the commands generally won’t affect functionality of the code. The example will still work as explained in the book. However, the way that the IDE presents output could change. For example, instead of being inline, plots could appear in a separate window. Even though using a separate window is less convenient, either method works just fine. If you ever do encounter a magic function-related problem, please be sure to let me know at [email protected].

Using Online IDEs

Many readers today want to code anywhere, using any device, and at any time. Obviously, hauling around a desktop system or even a high end laptop is not on the list of things they want to do. I thought it unique when a reader wrote me to say that coding on a smartphone should be included in my books. I have since had several more readers make the same request. So, I’m no longer surprised to hear about the various methods used to produce source code.

Personally, I think squinting while I code would be uncomfortable, but I definitely don’t want to hinder anyone’s learning process, so many (not all) of my introductory books now include a chapter on coding with mobile or online IDEs. For C++ All-In-One for Dummies, 4th Edition the mobile device tool of choice is CppDroid (a mobile IDE for C++). Python books, such as Beginning Programming with Python For Dummies, 3rd EditionPython for Data Science for Dummies, and Machine Learning for Dummies, 2nd Edition, rely on Google Colab (an online IDE). Just out of curiosity, I tried Google Colab using my smart TV and it did work—not that I plan to code using my TV anytime soon. Even though my latest book, Machine Learning Security Principles, doesn’t include any sort of IDE setup chapter, I did test the source code using Google Colab for that book as well.

Any time you change IDEs, you need to test your code to actually ensure that it will work with that IDE. Consequently, during the writing process I carefully tested every example on both my desktop system and the alternative IDE that the book supports. This dual testing process helps ensure you have a great learning experience. Unfortunately, I don’t have the time or resources to test every possible IDE out there. To obtain a good learning experience from my books, you need to choose one of the IDEs that I mention. In addition, it’s essential that you choose the correct version of the IDE, the one that matches the book, because vendors tend to introduce breaking changes into IDEs and compilers during the upgrade process.

When you contact me about an IDE issue, the first thing I need to know is which book (and edition of that book) you have, followed by the operating system and IDE version you’re using. Otherwise, it’s very tough for me to try to help you and I do want to help you within reason. No, I’m not going to try to support the alternative IDE that you like that was created for you by your long lost relative. I’ll only support the IDEs specifically mentioned in the book. That said, I do want to hear your input about IDEs at [email protected]. If you’re encountering a problem with the IDE that’s used in the book, I definitely need to know about it and I’ll post some helpful information about it on this blog.