Installation#
Goal#
Installation and setting up of pip, scikit-learn and jupyter
Screenshots#
Screenshots have been provided so that you can check and compare whether the output you have is the same as what we want from the step (or exercise) in question.
Installation of pip#
For installing pip
, you need to run the following commands on your terminal:
Note: Please note that all the lines starting with $
need to be run on the terminal.
$ sudo apt update
$ sudo apt install python3-dev
$ sudo apt install python3-pip
Setting up a virtual environment#
$ python3 -m venv env
$ source env/bin/activate
Installation of some important libraries#
Installation of jupyter
$ python3 -m pip install --upgrade --force-reinstall --no-cache jupyter
Installation of scikit-learn
$ python3 -m pip install scikit-learn
Installation of numpy
$ python3 -m pip install numpy
Installation of pandas
$ python3 -m pip install pandas
Installation of matplotlib
$ python3 -m pip install matplotlib
Hello World!#
If your installation is successful, you can run the following command to clone the repository
$ git clone https://github.com/johnsamuelwrites/TDM
$ cd TDM
Run Jupyter Notebook (or Lab)
$ jupyter notebook
or
$ jupyter lab
A new page will appear on your browser and you will see the following
image
Click on the tab ‘Running’. You see no notebooks running (if it’s the
first time you are running jupyter).
Go back to the ‘Files’ tab and click on New and choose Python3 under
Notebook
A new tab will open as shown below. Write the following code in the cell
print("Hello World!")
You can go to any cell and press ‘Run’
By default, your Notebook is named ‘Untitled’. You can rename it as shown below, by clicking on the name ‘Untitled’ and by giving a new name.
Now go back to the ‘Files’ tab and you can see the renamed notebook.
You can click on your notebook at any time to continue working.
Now let’s continue working on your current Notebook. Write the following code to check whether scikit is properly installed.
The code below shows the available datasets from scikit.
from sklearn import datasets
print(datasets.__all__)
Now, you are ready to go!!