What is Jupyter Notebook and Anaconda? Beginner Guide
Jupyter Notebook is a web-based interactive computational environment for creating Jupyter (IPython) notebooks.
A Jupyter notebook is a rich text file that can store either Python code or Markdown-like formatted text and include embedded hyperlinks to text files, other Jupyter notebooks, or URLs. It can store almost any kind of content in a Jupyter notebook.
What Is Jupyter Notebook and Anaconda?
Jupyter Notebook turns your browser into a Python development environment. The only thing you have to install is Anaconda. In essence, it allows you to enter a few lines of Python code, press CTRL+Enter, and execute the code. You enter the code in cells and then run the currently selected cell.
There are also options to run all the cells in your notebook. This is useful if you are developing a larger program.
What Is Anaconda?
Anaconda is a free and open-source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing that aims to simplify package management and deployment. The package management system conda manages package versions.
Anaconda is the easiest way to ensure you don’t spend all day installing Jupyter. Simply download the Anaconda package and run the installer. The Anaconda software package contains everything you need to create a Python development environment. Anaconda comes in two versions—one for Python 2.7 and one for Python 3.x. For this guide, install the one for Python 2.7.
- Download and install Anaconda.
- Once you’ve installed Anaconda, you’re ready to create your first notebook. Run the Jupyter Notebook application that was installed as part of Anaconda.
- Your browser will open to the following address: https://localhost:8888. If you’re running Internet Explorer, close it. Use Firefox or Chrome for the best results. From there, browse to https://localhost:8888.
- Start a new notebook. On the right-hand side of the browser, click the drop-down button that says “New” and select Python or Python 2.
- This will open a new iPython notebook in another browser tab. You can have many notebooks open in many tabs.
- Jupyter Notebook contains cells. You can type Python code in each cell. To get started (for Python 2.7), type print “Hello, World!” in the first cell and hit CTRL+Enter. If you’re using Python 3.5, then the command is print(“Hello, World!”).
How to create an environment in Conda and Jupyter?
Let’s imagine you want to use Jupyter Notebook to install both Tensorflow 2.0 and Tensorflow 1.15.
First, decide whether you want to utilise Tensorflow on the GPU or the CPU for this example. Add “-gpu” to TensorFlow to use the GPU version; otherwise, leave it alone.
We may use the following command to build a new conda environment.
When you run the following command, you should see three environments if everything went well:
conda create --name tf-2.0 conda create -n tf-2.0 tensorflow-gpu pip ipykernel conda create -n tf-1.15 tensorflow-gpu==1.15 pip ipykernel conda env list
Anaconda is a useful package that already includes a number of Python packages and provides for a quick entry into the Python world. It also allows you to create Python environments that contain multiple versions of your Python packages. For example, if a programme only runs on Python 2.7 or older versions of Matplotlib, you may establish a separate workspace for it and switch to Python 3 with a single click.
Additionally, moving between Tensorflow 2.0 and Tensorflow 1.15 is simple, allowing you to simply swap between versions (which can be quite a headache otherwise).
Miniconda is a stripped-down version of Anaconda that might be useful if you’re working on a server with limited storage space.
To install Anaconda or Miniconda, go to their website (https://www.anaconda.com/products/individual#Downloads) or copy the following instructions into your terminal if you’re using Linux.
When you run Jupyter Notebook in the basic environment, you should see a tab with “Extensions” and “conda”/”environments.” Go to Extensions and enable any extensions you want, then use the “new” button to create a new notebook if you’re ready. You should be able to select your basic, tf-2.0, or tf-1.15 environment here.
You must run jupyter notebook in the basic environment at all times. To exit your current environment and return to the basic one, runconda deactivate.
If you need to install more packages, activate an environment with conda activate [NAME], perform your commands with conda install Xorpip install X, and then deactivate it with conda deactivate.