Как запустить jupyter notebook через terminal
Перейти к содержимому

Как запустить jupyter notebook через terminal

  • автор:

Running the Notebook#

Start the notebook server from the command line :

You should see the notebook open in your browser.

Starting the Notebook Server#

After you have installed the Jupyter Notebook on your computer, you are ready to run the notebook server. You can start the notebook server from the command line (using Terminal on Mac/Linux, Command Prompt on Windows) by running:

This will print some information about the notebook server in your terminal, including the URL of the web application (by default, http://localhost:8888 ):

It will then open your default web browser to this URL.

When the notebook opens in your browser, you will see the Notebook Dashboard , which will show a list of the notebooks, files, and subdirectories in the directory where the notebook server was started. Most of the time, you will wish to start a notebook server in the highest level directory containing notebooks. Often this will be your home directory.

Notebook Dashboard

Introducing the Notebook Server’s Command Line Options#

How do I open a specific Notebook?#

The following code should open the given notebook in the currently running notebook server, starting one if necessary.

How do I start the Notebook using a custom IP or port?#

By default, the notebook server starts on port 8888. If port 8888 is unavailable or in use, the notebook server searches the next available port. You may also specify a port manually. In this example, we set the server’s port to 9999:

How do I start the Notebook server without opening a browser?#

Start notebook server without opening a web browser:

How do I get help about Notebook server options?#

The notebook server provides help messages for other command line arguments using the —help flag:

Detailed information about command line arguments, configuration, and usage.

Using a command-line interface#

Notebooks can be executed from your terminal using the run subcommand. It expects notebook paths as input arguments and accepts optional flags to modify the default behavior.

Running a notebook is this easy.

You can pass more than one notebook as well.

By default, notebook errors will be raised and printed into the terminal. You can suppress them by passing the —allow-errors flag.

For more sophisticated execution options, consider the papermill library.

How do I launch jupyter notebook from my terminal?

Trying to Launch jupyter notebook from terminal. I am currently on my terminal in the correct folder, and I have python 3.5 installed along with conda. But it is not launching.

peterh's user avatar

3 Answers 3

Jupyter Notebooks allow you to open IPYNB notebooks in the location you prefer. I generally recommend the following:

  1. First create a folder at your preferred destination
  2. Then go to terminal/cmd prompt and navigate to your above made destination
  3. Once in the destination then type in jupyter notebook

This will then automatically trigger the browser and open the Home tab, you can start a new notebook with your preferred kernel, rename and save the notebook, which it saves at the location where you navigated through the terminal

This helps you organize your relevant/related notebooks in the same place in a structured manner.

How to Start and Run a Jupyter Notebook

As discussed in the introduction, Jupyter notebooks provide a tremendous advantage for scientific computing, analysis and visualization. Here, we will explain how to start a Jupyter notebook. We will present just enough information to get you started. For a more complete treatment of Jupyter notebook software, please read the official documentation.

In the previous section, we explained how to download and install a complete Python installation with Anaconda for both Mac OS X and Windows. Armed with this experience, we will demonstrate how to start a Jupyter notebook in order to run code.

The Jupyter Notebook software is included in the Python installation we obtained from Anaconda. There are at least two scenarios in which you may want to run a Jupyter notebook:

  1. You aim to further experiment with, or augment, an existing Jupyter notebook like the ones that already exist within a repository in github.
  2. You want to develop a Jupyter notebook or series of notebooks for uses such as supplementing teaching material, or for a scholarly journal article, for example.

In both cases, you will want to start the Jupyter notebook in a specific folder.

Starting a Jupyter Notebook in a Specific Folder

On Mac OS X, create a Desktop folder with the Finder called my-notebook . In the last section, we learned how to start the OS X Terminal. Launch the Terminal again so that we may start Jupyter. Change to that directory (i.e., open the newly created my-notebook folder) with the cd command: cd

character is a shortcut to indicate you are at your home directory.

On Windows, create a Desktop folder called my-notebook . Hold down the shift key and right-click on the newly created folder. A context menu will appear and there will be an option to, «Open command window here». Click this option to launch the Windows Command Prompt at that specific location.

We can now start our Jupyter notebook with this command:

Once entered, this command will automatically launch your default web browser with a new notebook in an empty directory.

To actually create a notebook, go to the New, Python 3 menu item.

Enter some code in the first cell:

and press Shift-Enter to actually run the cell yielding

For more information on the basics of using the Jupyter Notebook, we recommend starting with this notebook on Notebook Basics.

How to Run OPT Jupyter Notebooks

This project includes a series of Jupyter notebooks for learning Python with geoscience objectives. They are located in the notebooks folder in the git master branch. In order to clone this project or any projects containing Jupyter notebooks such as the Unidata Python Workshop, please see the section on git and github. Once you have cloned your repository, change directory to where the Jupyter notebooks are located in the repository folder (e.g., the notebooks directory) and start Jupyter with the jupyter notebook command.

MyBinder and Starting your Jupyter Notebook in the Cloud

MyBinder is a third option that runs Jupyter notebooks on a cloud server that is setup on your behalf. If the project has enabled MyBinder, you will see a badge on the github project page. MyBinder is available for the Unidata Python Workshop Jupyter notebooks at this link. See the MyBinder website for more information.

How to install and execute Jupyter Notebook on Ubuntu 18.04

A little bit of retrospect first. In 2001 was created IPython, or Interactive Python, a command shell architecture for interactive computing in multiple programming languages, originally developed for the Python programming language [1]. The IPhyton kernel provides flexible and embeddable interpreters to load into projects and easy to use high performance tools for parallel computing [2].

Later in 2014, Project Jupyter was created as a spin-off from the IPhyton kernel. The notebook interface and other language-agnostic (language independent) parts of IPython were moved under the Jupyter name [3]. By default Jupyter Notebook ships with the IPython kernel but there are over 100 Jupyter kernels as of May 2018.

Fun fact, Jupyter is language agnostic and its name is a reference to core programming languages supported by Jupyter, which are Julia, Python, and R.

Checking your Python version

First of all, it’s good to check which python versions you have available in your system. To see the installed version, you can run the following command:

The output should look something like this:

In my particular case I have 3 python versions installed, python 2.7, python 3.6 and python 3.8. Running purely $ python in the terminal yields the corresponding 2.x version of python. Also, running $ python3 yields the corresponding 3.x version of python.

If you want to install a particular python version, let’s say, the latest python 3.8.2 version, we run the following command:

Installing Jupyter Notebook — What didn’t work

To install Jupyter Notebook I inicially went to the official channels, like the official webpage of the Project Jupyter and the Jupyer documentation to look for installing tutorials. For my surprise they don’t use the same installing commands. In [6] $ sudo install notebook is required, while in [7] the listed command is $ sudo install jupyter . I tried both and they returned jupyter command not found when I ran $ jupyter notebook .

Searching for this issue I found that other users had previously the same problem and luckily I also found a solution. The bad news is that the solution required another set of downloaded packages.

Installing and Executing Jupyter Notebook — What DID work

In the issue reported here a simple installing procedure is mentioned, I tried and it worked. The installing command is as follows:

After finishing installing run the notebook with $ jupyter-notebook . Be aware for the ‘-’ character, because it is required to run the command. When you execute the command above a Jupyter interface will load in your browser with the notebook.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *