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’.
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:
The start-up location in Linux(Ubuntu):
macOS 10.14: Mojave
The start-up location in macOS:
The start-up location in Windows 10:
The Simple Solution to Open from the Desired Location
Go to the desired directory and right-click to select ‘Open in Terminal’:
In the Terminal, type ‘jupyter notebook’:
Open the desired location using Finder and right-click to select ‘New Terminal at Folder’:
In the Terminal, type ‘jupyter notebook’(as in Linux):
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.
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).
Afterward, type ‘jupyter notebook’ and the Jupyter Notebook will be opened.
Note that the Jupyter Notebook’s home page does not list anything if the folder is empty.
Once a Python3 notebook is created, the home page will list the files.
To install Jupyter Notebook for different environments, refer to my blog here:
Installing Jupyter Notebook for Different Environments in Windows 10
To install Jupyter Notebook in various virtual environments and how to deal with the pywin32 error that may encounter…
Hope this will help you in getting things done using Jupyter Notebook in a location of your choice. Happy Coding!!!