Mac Jupyter Notebook App

This app has a strange interface, although it’s straight forward. When I try to open a Jupyter notebook, the whole point of the app, I get the message 'cannot connect to localhost”. So this app pretty much does nothing other cost you money. There’s probably a fix for this but I cannot find any documentation. Wish I could have my $.99 back. Launching Jupyter Notebook App¶ The Jupyter Notebook App can be launched by clicking on the. It's almost the same (as jupyter) but has very lightweight app for mac, so i don't have to start any kind of server Guest. Aug 2020 Disagree Agree nteract is an Electron-based, cross-platform desktop application that uses Jupyter kernels but gives you a richer interface and OS native file-associations, etc. Guest. Jul 2017. 2 agrees. Jupyter Notebook, popularly known as Jupyter among data science aficionados, is an open-source interactive coding application which allows the user/programmer a plethora of options such as testing code, equations, data visualisations, text and many more, using the Python programming language. Primarily used for data visualisation, Jupyter is. So, Jupyter Lab is starting to get really interesting as a day-to-day replacement for standard Jupyter Notebooks and as a python competitor to R’s RStudio IDE.But, while a Jupyter Notebook with its multi-page interface feels right at home in the browser, I feel that as a single page application, Jupyter Lab would work better as a standalone desktop app without all the unwanted “chrome. They also can be executed to perform the data analysis in real-time' —How to install Jupyter Notebook on Mac using Homebrew. Let's look at these components in more detail. What is the Jupyter Notebook App? As a server-client application, the Jupyter Notebook App allows you to edit and run your notebooks via a. I'm trying to select and comment # multiple lines using Jupyter Notebook on Mac with French keyboard layout and no numpad. To type the slash (/) on this keyboard, the shortcut is Shift +:When trying to comment lines on Jupyter: with Ctrl + Shift +: it doesn't work; Neither Ctrl + #; Or Cmd +:; or Cmd + Shift +:; However on a Chromebook with French keyboard layout I'm able to do Cmd.

Upgrade to Python 3.x

Download and install Python 3.x. For this tutorial I have used 3.5.

Once you downloaded and run the installation app, Python 3 will be installed under:

The installer also adds the path for the above to your default path in .bash_profile so that when you type:

on the command line, the system can find it. You'll know you've been successful if you see the Python interpreter launch.

Install pip

Fire up your Terminal and type:

Install PySpark on Mac

  1. Go to the Spark downloads page and choose a Spark release. For this tutorial I chose spark-2.0.1-bin-hadoop2.7.
  2. Choose a package type. For this tutorial I have choses Pre-built for Hadoop 2.7 and later.
  3. Choose a download type: (Direct Download)
  4. Download Spark: spark-2.0.1-bin-hadoop2.7.tgz
  5. Unzip the folder in your home directory using the following command. tar -zxvf spark-2.0.1-bin-hadoop2.7.tgz. I prefer create an opt directory in my home directory and then unzip it under ~/opt/.

Next, we will edit our .bash_profile so we can open a spark notebook in any directory. So fire up your Terminal and type in:

my .bash_profile looks as follows:

The relevant stuff is:

The PYSPARK_DRIVER_PYTHON parameter and the PYSPARK_DRIVER_PYTHON_OPTS parameter are used to launch the PySpark shell in Jupyter Notebook. The --master parameter is used for setting the master node address. Here we launch Spark locally on 2 cores for local testing.

Install Jupyter Notebook with pip

First, ensure that you have the latest pip; older versions may have trouble with some dependencies:

Then install the Jupyter Notebook using:

Thats it!

You can now run:

in the command line. A browser window should open with Jupyter Notebook running under http://localhost:8888/

Configure Jupyter Notebook to show line numbers

Run

to get the Jupyter config directory. Mine is located under /Users/lucas/.jupyter.Run:

Run:

to create a custom directory (if does not already exist).Run:

Run:

and add:

You could add any javascript. It will be executed by the ipython notebook at load time.

Install a Java 9 Kernel

Install Java 9. Java home is then:

Install kulla.jar. I have installed it under ~/opt/.

Download the kernel. Again, I placed the entire javakernel directory under ~/opt/.

This kernel expects two environment variables defined, which can be set in the kernel.json (described below):

So go ahead and edit kernel.json in the kernel you have just download to look as follows:

Run:

Run:

Run:

to copy the edited kernel.json into the newly created java directory.

Jupyter

Install gnureadline by running:

in the commoand line.

If all worked you should be able to run the kernel:

and see the following output:

Jupyter Notebook Application

If you have ever worked on Jupyter and Rails, you'd probably wanted to execute Rails codes inside the Jupyter Notebook. Although it was already possible to achieve it, the experience was not so good; not as slick as those developer experience you get when you are riding the rail.

To tackle this problem and make Rails Jupyter friendly, I've made a gem called jupyter_on_rails. With this gem, working on a Rails project will get helped by the power of Jupyter (Notebook).

By adding following gems to your Rails project's Gemfile and making the bundle install succeed,

Following things are achieved:

  • rake jupyter:notebook command to start a Jupyter Notebook server with your Rails app's kernel installed at your project local.
    • the iruby kernel configuration is confined to your project; no more troubles of global iruby configuration headache, if you know what I mean.
  • Some methods which makes it easy to operate ActiveRecord operations on Jupyter Notebook.

Here is the example screenshot of what you'll achieve:

Prerequisites

To use jupyter_on_rails, you need to have jupyter available at your project, and you need to have all the libraries needed for the installation of dependency gems to be success.

For jupyter command, you have 2 options. One is installing globally by using e.g. pip install jupyter, or by creating pipenv environment at your project root and having jupyter there. My personal recommendation is using the Pipenv. For those rubyists who is unfamiliar with pipenv, it is a bundler for python.

You can check whether Jupyter notebook is properly installed by executing:

If jupyter notebook web page is opened, then the jupyter installation is success.

Next, you need to install the libraries needed for the dependencies of jupyter_on_rails and ffi-rzmq. For this, since I cannot remember what was exactly needed for these gems, please refer to each gem's installation instruction if any bundle install error occurs. I can tell that all the required libraries could be installed by using Homebrew if you're using Mac.

Adding jupyter_on_rails to mac and launching Jupyter

Once you have your jupyter ready, put following dependencies in your Gemfile.

Then bundle install. Install libraries to make install success if necessary.

After that, you can execute following command, to launch a Jupyter which have your app's kernel installed.

Below is the image of what that command execution will be look like. At top terminal, you can see the rake jupyter:notebook command launching a jupyter server, at left bottom you see that when launching a new notebook, one can choose the rails app. At right bottom you see ApplicationRecord, one of the classes from the Rails context, can be used without any requires or other configurations; it should work out of the box. (If you have used rails console, then the kernel's context is exactly the same as that context.)

Mac Jupyter Notebook App

If you have hard time looking at the image due to it's resize caused by CDN, refer to the original image at https://raw.githubusercontent.com/Yuki-Inoue/jupyter_on_rails/master/the_screenshot.png .

ActiveRecord integrations

The jupyter_on_rails comes with some utility methods which helps you operate ActiveRecord on the notebook.

Most notable is the ActiveRecord::Relation#to_df method. This turns your ActiveRecord::Relation instance into Daru::DataFrame instance. For those unfamiliar with what a Dataframe is, it is a table like structure which can be used for further data manipulation. It is also Jupyter friendly. For those with python context, it is the pandas.DataFrame in ruby.

The image above shows how #to_df method works. 1. You can turn your model into DataFrame 2. The includes is taken into account when creating DataFrame 3. It works on the Relation.

Mac Jupiter Notebook App Downloads

So now, you have the DataFrame. Refer to official documentation for how you work with the instance. https://github.com/SciRuby/daru

After modifications, you'd may want to write DataFrame data back to your model. You can achieve it by Daru::DataFrame#write_model(SomeModel). Below is again the screenshot of what its execution will look like. Note that this is extension method against daru made by jupyter_on_rails.

Jupyter Notebook For Mac

The rake jupyter:notebook command creates an .ipython configuration at the project root. It basically copies the iruby kernel configuration, and adds boot information there. All the information needed for the kernel to boot rails is stored as configuration for kernel. On each invocation of this kernel, config/application.rb is loaded, and application.initialize_environment! is called, so that Rails configuration is available.

Below is the Github project of this gem. For bugs/feature requests, please submit them there.

Jupyter Notebook Install

Thanks for reading.