Install and import in Jupyter Notebook

  • Thread starter fog37
  • Start date
  • Tags
    install
In summary, the import command is used to link external code to a Python script in Jupyter notebooks, while the install command reaches out to the internet to load new modules that are not already installed. The Anaconda distribution is a popular choice for its pre-loaded libraries and modules.
  • #1
fog37
1,568
108
TL;DR Summary
install and import commands meaning
Hello again,
  • import command: when working with Jupyter notebooks and Python, the command import is used to import both modules and libraries into the working environment, i.e. the notebook itself, correct? This means that the module or library is already installed, i.e. all the code is already present in our computer (it was provided when we downloaded Jupiter or the distribution that Jupyter comes from), and we are making its capabilities accessible from within the notebook...
  • install command: In Jupyter notebook, when we use the install command, will the module/library and all its code be uploaded from the internet? Does that mean there must be an active internet connection to perform this installation task?
Thanks!
 
Technology news on Phys.org
  • #2
import is a python statement to link python code to your python script.

Several languages including Python, Java and Julia use this approach to attach external code to a program.

I've used Jupyter notebooks and they didn't require an internet connection as the server ran on my local machine. However some Python modules might need to be downloaded if they are already present.

Many people choose the Anaconda distro with Jupyter notebooks so that most modules of interest are already installed and ready to use.

https://lectures.quantecon.org/py/getting_started.html
 
  • #3
The import command is what's used for a specific Jupyter notebook. It loads libraries from what is already installed on your computer.

The install command does reach out to the internet to load new modules that you haven't previously installed. Once they're loaded, you can then use them in an import.

As @jedishrfu suggested, the Anaconda distro is the best starting point and contains many pre-loaded libraries and modules.
 
  • Like
Likes jedishrfu and fog37

1. What is Jupyter Notebook?

Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It supports over 40 different programming languages and is commonly used for data science and scientific computing.

2. How do I install Jupyter Notebook?

To install Jupyter Notebook, you will need to have Python installed on your computer. Once you have Python, you can use pip (Python's package manager) to install Jupyter Notebook. Simply open your terminal or command prompt and type "pip install jupyter". This will install Jupyter Notebook on your computer.

3. How do I open Jupyter Notebook?

To open Jupyter Notebook, you will need to navigate to the directory where you want to work and then type "jupyter notebook" in your terminal or command prompt. This will open a new tab in your web browser where you can start using Jupyter Notebook.

4. How do I import libraries in Jupyter Notebook?

To import libraries in Jupyter Notebook, you can use the "import" statement followed by the name of the library. For example, to import the popular data analysis library pandas, you would type "import pandas" in one of your notebook cells. You can also use the "as" keyword to give your library a nickname, such as "import pandas as pd".

5. Can I use Jupyter Notebook with languages other than Python?

Yes, Jupyter Notebook supports over 40 different programming languages, including R, Julia, and Scala. You can switch between languages by selecting the appropriate kernel (a program that runs and introspects the user's code) from the "Kernel" menu in your notebook.

Similar threads

  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
3
Views
2K
Replies
6
Views
662
  • Programming and Computer Science
Replies
12
Views
6K
  • Programming and Computer Science
Replies
1
Views
275
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
1
Views
912
  • Programming and Computer Science
Replies
15
Views
5K
  • Programming and Computer Science
Replies
16
Views
2K
Back
Top