As we all know that Python is an Object-Oriented Programming Language and therefore it contains a lot of third-party libraries and inbuilt libraries which make coding easy for users. For carrying out operations using Python there are numerous code editors along with the default code editor that Python provides with the name IDLE.
We can use any type of code editor of our choice to write our codes. But, when it comes to performing Data Science related operations then some best editors are preferred by the Data Science community. These are the Jupyter Notebook and Google Colab. Calling them text editors is not correct as they are scientific Python notebooks with the extension .ipynb and help in proper data visualization and manipulation within their console.
Also because of their feature of providing code blocks, they are highly preferred by the Data scientists. But what if we want to download packages in them that is, how to download Python packages within the Jupyter environment?? It is possible and the solution to this question is very simple and given below:
Installing Python Packages using Jupyter Notebook
No matter from wherever you are accessing the Jupyter notebook that is from Azure, Python, or Anaconda it is possible to download Python packages. The steps to download packages in Jupyter are the same as is done by normally downloading from the Command Prompt or Anaconda Prompt that is through pip or conda.
To download a package say Numpy in Jupyter you first need to download the Jupyter using the command prompt or access the same using Anaconda or Azure and then open its console.
After opening the kernel or the console wait for the kernel to get ready. Once the kernel is ready just type pip install or conda install commands along with the name of the package that you want to install; wait and it will get downloaded within a few minutes.
There is one slight difference although if we are using Jupyter from our local system or accessing the same through the cloud. The difference is that when we are downloading packages in our local system through Jupyter we can just write pip install but when we are downloading the same packages in the cloud then we need to add an exclamation mark also before pip that is
!pip and the rest will be the same.
So, if we take NumPy example then on the local system it will be in:
pip install numpy
and for the cloud version:
!pip install numpy
So, with this nuance, we can download any package from the Jupyter Notebook on the cloud or local computer. Although downloading packages from the Command Prompt is mostly preferred by Pythonists because Jupyter takes a lot more time to download packages that would have been fast if we would have used Command Prompt. Also, there are issues with the Kernel of the Jupyter as it becomes dead due to heavy load or hangs a lot due to downloading heavy packages. Read More: How to install Jupyter notebooks on Windows 10/7
It is better to download packages from Command Prompt if you are using your local system and not cloud-based services because the downloading speed is comparatively high when are using CMD rather than going with the Jupyter installing packages.