DATA SCIENCE

Opening Jupyter Notebook From Any Desired Location

The simple way to run Jupyter Notebook from the location of your choice

Image for post
Image for post

Introduction

Jupyter notebooks have become the preferred workspace for the majority of Python data scientists. Jupyter is an open-source project that supports interactive data science and scientific computing across programming languages. The very name Jupyter derived from the three core programming languages it supports viz. Julia, Python, and R. The name is also a homage to Galileo’s notebooks that records the discovery of the moons of Jupiter.

The very name Jupyter derived from the three core programming languages it supports viz. Julia, Python, and R.

Jupyter Notebook can be installed using either pip(Python Package Installer) or Anaconda Individual Edition. Once installed you can run the Jupyter Notebook via Terminal(Linux/Mac), Command Prompt(Windows), or Anaconda Prompt by typing ‘jupyter notebook’.

jupyter notebook

The Jupyter Notebook runs from the start-up location based on the operating system the user is using. Hence the user will only be able to save the code in the start-up location. This is a great drawback. Don’t get disheartened as there are several ways to overcome this flaw of the Jupyter Notebook. Most of the tweaks are a bit complicated. Rest assured, as we will be discussing the simplest solution.

The start-up location for Linux, macOS, and Windows are shown below:

Linux(Ubuntu 20.04)

The start-up location in Linux(Ubuntu):

Image for post
Image for post
Image for post
Image for post

macOS 10.14: Mojave

The start-up location in macOS:

Image for post
Image for post
Image for post
Image for post

Windows 10

The start-up location in Windows 10:

Image for post
Image for post
Image for post
Image for post

The Simple Solution to Open from the Desired Location

Linux(Ubuntu)

Go to the desired directory and right-click to select ‘Open in Terminal’:

Image for post
Image for post

In the Terminal, type ‘jupyter notebook’:

Image for post
Image for post

macOS

Open the desired location using Finder and right-click to select ‘New Terminal at Folder’:

Image for post
Image for post

In the Terminal, type ‘jupyter notebook’(as in Linux):

Image for post
Image for post

Windows

The solution in Windows is a bit different from Linux and macOS. Open the desired location in Windows File Explorer, copy the desired location from the address bar of Windows File Explorer. Alt + D goes to the address bar and Ctrl + C copies the location.

Image for post
Image for post

Now open the Anaconda Prompt and type the following command:

cd D:\desired location

Somehow, the Anaconda Prompt returns to the original location. Enter ‘d:’ and the prompt will reach your desired location(as shown in the image below). Note that you must enter the drive letter of your desired location(C: for C:\ drive-the primary partition).

Image for post
Image for post

Afterward, type ‘jupyter notebook’ and the Jupyter Notebook will be opened.

Image for post
Image for post

Note that the Jupyter Notebook’s home page does not list anything if the folder is empty.

Image for post
Image for post

Once a Python3 notebook is created, the home page will list the files.

Image for post
Image for post

To install Jupyter Notebook for different environments, refer to my blog here:

Hope this will help you in getting things done using Jupyter Notebook in a location of your choice. Happy Coding!!!

Data Science Enthusiast striving to secure greater goals

Get the Medium app