Complete Beginner's Tutorial to Google Colab

Greg Hogg
16 May 202218:12

Summary

TLDRIn this video, Greg introduces the Google Colab environment, a cloud-based platform for running Python code in Jupyter notebooks. He demonstrates basic functionalities, such as writing and executing code, interfacing with the operating system, and utilizing Google Colab's GPU and TPU resources. Greg also explains how to manage files, handle variables, and install additional Python libraries. The video is geared towards beginners, emphasizing educational purposes and the ease of experimenting with machine learning models without needing high-end hardware.

Takeaways

  • πŸ˜€ The video is a tutorial on using Google Colab, not specifically a Python tutorial, but it involves writing some Python code.
  • πŸ“˜ Google Colab is an interactive Python environment, allowing users to write and execute Python code in 'cells'.
  • πŸ–₯️ Users can interface with the operating system within Google Colab using an exclamation mark before commands, similar to using a terminal in Linux.
  • πŸ” Colab provides access to sample data folders with pre-existing files useful for data science, which is a common use case for Jupyter notebooks.
  • 🌐 Google Colab is cloud-based, meaning the computation is done on Google servers, and it's free to use for basic functionality.
  • πŸ’» The video mentions that users can connect to different runtime types, including GPU or TPU, which can be beneficial for machine learning tasks.
  • πŸš€ Colab is particularly useful for those without access to powerful hardware, as it allows for machine learning model training without the need for expensive systems.
  • πŸ”„ The video demonstrates how to manage variables and lists within the Colab environment, highlighting the stateful nature of the environment compared to traditional script execution.
  • πŸ“‘ The script discusses the use of text cells in Colab for adding notes or documentation, following Markdown syntax for formatting.
  • πŸ“ The tutorial covers creating a table of contents using headings and subheadings to organize the notebook, which is helpful for navigating and understanding the code structure.
  • πŸ”Œ The video explains how to install new Python libraries using pip within Colab and the potential need to restart the runtime for changes to take effect.

Q & A

  • What is the main focus of the video script?

    -The main focus of the video script is to provide an introduction to the Google Colab environment, explaining its features, how it works, and its use for writing Python code, particularly in the context of data science and machine learning.

  • What is the difference between Google Colab and Jupyter Notebooks?

    -Google Colab is similar to Jupyter Notebooks in that they both allow for writing and executing Python code in an interactive environment. The main difference is that Google Colab is cloud-based, allowing users to connect to a runtime that can include GPU or TPU resources, which may not be available on their own computers.

  • How can you interact with the operating system in Google Colab?

    -In Google Colab, you can interact with the operating system by using an exclamation mark (!) before commands, such as 'ls' to list all files in the current directory, similar to using commands in a Linux shell.

  • What is the purpose of the sample data folder in Google Colab?

    -The sample data folder in Google Colab contains pre-existing files that are often used for data science. These files are included to facilitate users in learning and testing data science and machine learning models without needing to find or upload their own datasets.

  • What is the advantage of using Google Colab for data science and machine learning projects?

    -Google Colab provides an accessible and powerful platform for data science and machine learning projects by offering free access to computational resources such as GPUs and TPUs, which can significantly speed up the training of models and handling of large datasets.

Outlines

00:00

πŸ˜€ Introduction to Google Colab

Greg introduces the video with an overview of Google Colab, explaining it as an interactive Python environment. He clarifies that while the tutorial will involve minimal Python coding, the focus is on demonstrating the functionalities of Colab. Greg mentions the use of Jupyter notebooks for writing and interacting with Python code, and how Colab allows for GPU or TPU usage, which can be beneficial for data science and machine learning tasks. He also touches on the free nature of Colab, with the option for users to upgrade for more resources.

05:01

πŸ““ Exploring Colab's Features and Python Interaction

The second paragraph delves into the features of Colab, such as the ability to write and execute Python code in cells, interface with the operating system using shell commands, and the inclusion of sample data for data science projects. Greg demonstrates how to declare variables, execute shell commands, and interact with the file system. He also explains the use of Col

Mindmap

Keywords

πŸ’‘Google Colab

Google Colab is a cloud-based development environment designed for writing and running Python code in Jupyter notebooks. It is integral to the video's theme as it is the main platform discussed. The script mentions it as a free service that allows users to train machine learning models and write code without the need for a high-end computer.

πŸ’‘Jupyter Notebooks

Jupyter Notebooks are an open-source web application that allows users to create and share documents containing live code, equations, visualizations, and narrative text. In the script, they are described as the basis for the interactive Python environment in Google Colab.

πŸ’‘Interactive Python (IPython)

IPython is an enhanced interactive Python shell that provides a more interactive experience compared to the standard Python shell. The video script explains that IPython is used in Jupyter notebooks to write and execute Python code interactively, which is a key feature of Google Colab.

πŸ’‘Runtime

In the context of the video, the runtime refers to the computing environment where the code is executed. The script discusses how users can connect to a runtime in Google Colab and even change the type of runtime to access GPUs or TPUs.

πŸ’‘GPU (Graphics Processing Unit)

A GPU is a specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. The script mentions that Google Colab allows users to access GPUs for free, which is beneficial for running machine learning models that require significant computational power.

πŸ’‘TPU (Tensor Processing Unit)

A TPU is an AI accelerator application-specific integrated circuit (ASIC) developed by Google specifically for neural networks. The script positions TPUs as advanced GPUs, providing an even higher level of performance for machine learning tasks within Google Colab.

πŸ’‘RAM (Random Access Memory)

RAM is the primary storage in a computer and is used to store data that is being processed. The script warns that users may run out of RAM when training large machine learning models, which can be mitigated by using Google Colab Pro or by managing resources carefully.

πŸ’‘Pip

Pip is a package manager for Python that allows users to install and manage additional libraries. The script demonstrates how to use pip to install new libraries in Google Colab, which is essential for expanding the functionality of the environment.

πŸ’‘Markdown

Markdown is a lightweight markup language with plain-text-formatting syntax. The script explains that Google Colab allows users to write text in Markdown format, which can be used to create formatted documents, including headings and tables of contents.

πŸ’‘Table of Contents

A table of contents is a list of the headings of sections and subsections in a document. The script describes how to create a table of contents in Google Colab using Markdown, which helps in organizing and navigating through complex notebooks.

πŸ’‘Machine Learning

Machine learning is a subset of artificial intelligence that provides systems the ability to learn and improve from experience without being explicitly programmed. The script positions Google Colab as a tool for machine learning, given its ability to run complex models and access powerful computational resources.

Highlights

Introduction to Google Colab and its use as an interactive Python environment.

Explanation of Jupyter Notebooks for writing and executing Python code interactively.

Demonstration of how to write and output Python variables within Colab.

Showcasing the ability to interface with the operating system using Google Colab.

Highlighting the inclusion of sample data for data science in Colab's environment.

Differences between local Jupyter and cloud-based Colab, including runtime options like GPU and TPU.

The free use of Colab for machine learning models and coding without the need for high-end hardware.

Mention of Colab Pro for enhanced features like more RAM and better GPU/TPU access.

The importance of using Colab responsibly to avoid resource limitations.

How to write and execute Python code cells and interface with the OS using the exclamation mark.

Using the file system within Colab, including creating new folders and viewing hidden files.

Introduction to the variable inspector in Colab for examining stored variables.

Explanation of how to use text cells in Colab to create a table of contents with markdown.

The persistent state of variables in Colab, unlike traditional Python scripts.

How to upload and download files in Colab with caution due to the temporary nature of the environment.

The option to mount Google Drive for more permanent file storage within Colab.

How to manage RAM usage in Colab and what to do if the environment crashes due to insufficient memory.

The process of installing new Python libraries in Colab using pip and potential need for runtime restarts.

Final thoughts on using Colab for learning and testing rather than heavy-duty professional use.

Transcripts

play00:00

hey everyone my name is greg and today

play00:02

we're going to learn about the google

play00:03

collab environment so this is not a

play00:06

specifically python tutorial in google

play00:08

colab although we will write a little

play00:10

bit of python code very little this is

play00:13

showing how the environment works and

play00:14

just what it's about so basically if

play00:17

you're not familiar with jupiter or

play00:19

jupiter notebooks basically what they

play00:21

are is this way to write python code and

play00:23

what we call i so interactive python so

play00:27

pi and then nb notebooks so we're

play00:29

writing code in interactive python

play00:32

notebooks where what that means is

play00:34

basically ignoring text for now because

play00:36

that's really just text we'll look into

play00:37

that a little bit you write code and

play00:39

usually python code into these cells or

play00:42

for example i could get a variable maybe

play00:44

x is equal to five so i made an integer

play00:47

five and made that equal to x and we can

play00:50

actually output that without even

play00:52

writing print we can go ahead and just

play00:54

leave that as the last line as long as

play00:56

that's the last line even over here it's

play00:59

still going to output it because these

play01:00

are just empty lines it outputs that

play01:03

variable and puts it right here and what

play01:05

we call say the output terminal and

play01:07

actually you can sort of interface with

play01:09

the operating system a little bit in

play01:11

google collab as well for example with

play01:13

exclamation you can do something like ls

play01:16

which is like list all of the files

play01:18

that's how you do that in linux well it

play01:20

does that same thing it shows sample

play01:21

data that's really all that's here we

play01:23

have this sample data folder which has a

play01:26

bunch of pre-existing files that are

play01:28

often used for data science so most of

play01:30

the time ipython notebooks are for data

play01:32

science and machine learning not always

play01:34

but most the time and so they do have

play01:36

these files included in there already so

play01:39

it's pretty similar to jupiter but the

play01:40

main difference is that you go and

play01:42

connect to a runtime and you can change

play01:45

the runtime type as well and get a gpu

play01:48

or tpu even if your own computer doesn't

play01:50

have one so this is a cloud-based and

play01:53

based thing where you have to go into

play01:55

the browser go to google collab and

play01:57

although it may look like it's running

play01:59

on your computer most of this stuff is

play02:01

not actually running on your computer

play02:02

you are just interfacing with it via

play02:05

this notebook you know writing the code

play02:06

here what it actually does is puts this

play02:09

all on google servers and completely for

play02:12

free unless you get cov plus which i

play02:14

think gives you more ram sometimes you

play02:15

run out of ram machine learning models

play02:17

do tend to eat up ram a lot so you may

play02:19

actually run out of ram and you can get

play02:21

better access to gpus or tpus with cobot

play02:24

plus but unless you do any of that you

play02:26

are just using colab servers for free so

play02:29

that you can train machine learning

play02:30

models or just really write code in a

play02:32

nice way without worrying about a fancy

play02:35

computer you don't have to go out and

play02:36

buy some big system so that you can

play02:38

train machine learning models and you

play02:40

know if you are like a company or

play02:42

someone that's making a startup and

play02:44

you're relying on training important

play02:45

machine learning models collab may not

play02:47

be enough for you you may have to go for

play02:50

some sort of an upgrade for one of the

play02:51

cloud-based systems or get your own

play02:53

system like a good nvidia or amd and

play02:56

actually the apple stuff is getting

play02:58

better for gpus as well

play03:00

but this is a cloud-based resource

play03:02

mainly for education purposes so

play03:04

probably you're not going to want this

play03:06

if you are a heavy duty user it's more

play03:09

so great for just kind of testing things

play03:11

and mostly learning so we've seen a

play03:13

couple of the pieces you can write code

play03:15

and then you can kind of interface with

play03:17

the operating system we could do that a

play03:19

little bit more we could do exclamation

play03:21

which really just means interface with

play03:23

the the os versus the actual python code

play03:27

if you don't do exclamation you're just

play03:29

writing python code if you're doing an

play03:31

exclamation you could do something again

play03:32

like pwd that means print the working

play03:35

directory they made our working

play03:36

directory slash content and if you

play03:38

really wanted you know you could

play03:40

actually tool around here and view

play03:42

hidden files this tab here this is your

play03:44

files and you could go in to look around

play03:46

here but almost all of the time

play03:49

you won't need to do any of this you may

play03:51

want to make a new folder and you can do

play03:53

that if you want you could do

play03:55

exclamation maker we'll just call it new

play03:57

underscore folder we'll do that and you

play04:00

should if you refresh you will actually

play04:02

see a new folder and you can do stuff

play04:04

like that if you want to something

play04:06

interesting in google colab and i

play04:08

believe is only available in jupyter

play04:10

notebook

play04:11

if you have some extensions is this kind

play04:13

of variable thing and you're seeing

play04:15

stuff that actually shouldn't really

play04:16

exist because i did this earlier these

play04:19

are all of the variables that it

play04:20

currently has stored and so you can

play04:22

actually look them up so if we did

play04:24

something like f is equal to let's make

play04:27

it the list of one two and then three we

play04:30

should actually see f pop up over here

play04:33

and you can filter by if i type f that

play04:35

is going to come up just a normal

play04:37

alphabetical based search and it says

play04:39

it's a shape of three items so the shape

play04:42

thing is basically actually if you hover

play04:44

it apparently it does show you what it

play04:46

is

play04:46

this shape only really makes sense for

play04:49

uh for numpy arrays and the reason that

play04:52

that's actually getting its own column

play04:54

is because again this is often for

play04:56

training machine learning models having

play04:57

stuff in numpy arrays and tensors is

play05:00

extremely common and so this is a two by

play05:03

two array uh you can't see it because

play05:05

this was earlier but if i did show you i

play05:08

made a earlier and it's the numpy array

play05:10

with the the first row is one two and

play05:13

the second row is three four and so its

play05:15

shape is two by two it has two rows and

play05:17

two columns now just a quick example of

play05:20

text if you wanted to you could easily

play05:22

write any text you just do the add text

play05:24

thing there or maybe add text here by

play05:26

the way you can just kind of delete

play05:28

cells as you want to here delete and you

play05:30

can also move them around this is moving

play05:33

this one into different locations i'll

play05:35

just place it back at the bottom you

play05:36

could put any text anywhere you wanted

play05:38

and if you just type some text say hi

play05:40

well all that is is going to have hi it

play05:43

really follows the markdown rules and

play05:45

sort of slightly different and weird

play05:47

scenarios but what it is basically is if

play05:50

you do another text and then we write

play05:52

say a hashtag a hashtag and then hi what

play05:55

that single hashtag was and by the way

play05:57

i'm double clicking to go into the

play05:58

editor there and i'm just single

play06:00

clicking to to look at how it looks

play06:01

normally if i double click there you'll

play06:03

see the hashtag and then i think you do

play06:05

need the space in between

play06:07

no actually you don't so just hashtag

play06:09

and then text normally people put a

play06:11

space there though you should be able to

play06:13

see in the table of contents we have the

play06:15

section called hi

play06:17

and if you were to do say another piece

play06:19

of text anywhere else you could do two

play06:21

hashtags and then say hi as well

play06:25

and basically what that does is it is

play06:27

see and indents it because that's a

play06:30

subsection we have the main section high

play06:32

then we have a subsection

play06:34

of this high as well over here and i

play06:36

believe the furthest level of indenting

play06:38

you can go is three so we could do a or

play06:41

maybe four actually but i don't think

play06:43

you can go infinitely at least you

play06:45

definitely don't want to go past three

play06:46

or four if we do another hashtag we'll

play06:48

do three hashtags and then say hello

play06:51

that is going to nest it under that

play06:53

section and if you did say you know just

play06:55

two of them we could do uh hi we'll just

play06:58

do the number seven you can see that

play07:01

places it at its appropriate level

play07:03

indentation that has two hashtags and so

play07:06

that goes at the same level of the other

play07:08

two hashtag things so you can build up a

play07:10

table of contents that way if you wanted

play07:12

and you could make it simple and just do

play07:14

only single sections so you could say

play07:16

you know this is high too this is

play07:18

another section and it seems to be

play07:20

placing it under that no there we go it

play07:21

takes a second for it to figure it out

play07:23

sometimes but what the nice thing is is

play07:25

you can click on these and it's going to

play07:26

bring you to those

play07:28

appropriate sections in the code so

play07:30

wherever you want to kind of set up your

play07:32

table of contents where you have

play07:34

sometimes people when they're training

play07:35

models they'll do something like um you

play07:37

know getting the data or actually

play07:39

imports and then getting data

play07:41

pre-processing model training final

play07:43

evaluation

play07:44

maybe maybe an exploratory data analysis

play07:46

you could make all of those a section

play07:48

and then you could have sub sections

play07:50

within those if you wanted to and that

play07:52

makes it look good both for the

play07:54

organization of the code like from the

play07:56

table of contents level and just looking

play07:58

at the code i can really help people

play08:00

especially if you are sharing these with

play08:02

people uh can really help people

play08:04

understand and yourself what is going on

play08:06

again if you did want to get a gpu you

play08:08

can always go into runtime and then

play08:10

change runtime type nor by default you

play08:13

won't have a hardware accelerator which

play08:15

is just a graphics processing unit and

play08:17

then there's a tensor processing unit

play08:19

gpu is for both gaming display uh and

play08:22

for number crunching still on here they

play08:24

really mean it just as a number cruncher

play08:26

or for machine learning and for tpu in

play08:28

this context you can really think of

play08:30

that as just an advanced gpu

play08:32

and so they're going to have least

play08:34

access to tpus a little bit less access

play08:37

to gpus and you should very rarely have

play08:39

trouble uh finding a server and

play08:41

appropriate resources when you're just

play08:43

on none here

play08:44

and why am i saying this thing about

play08:45

resources well basically how this works

play08:48

uh is that google treats you you know

play08:50

how you treat it and so if you go to

play08:53

really abuse the gpu like if you're just

play08:55

when you're logging into your account

play08:57

and you're constantly using a gpu uh

play08:59

they are not going to like you for that

play09:00

tpu you know they're not going to like

play09:02

you for that either just use it when you

play09:04

have to use it for a couple of minutes

play09:06

when you're training a model and then

play09:07

you shouldn't run into any difficulties

play09:09

but yeah just just be nice to them

play09:11

because they're being nice to us for

play09:12

doing this for free now a little bit

play09:13

into the python code just to make sure

play09:15

we understand jupiter itself now this is

play09:18

a little bit different than just running

play09:19

a python script top to bottom because as

play09:22

you can see we still have all these

play09:24

variables that exist right now if we go

play09:26

into variables you'll see all of these

play09:29

things normally like in a python script

play09:31

it'll just run top to bottom you know

play09:33

occasionally like he'll jump around for

play09:35

functions you'll jump up and down for

play09:37

loops or if statements and stuff but in

play09:40

general you run it from top to bottom

play09:42

and then you're not going to have like

play09:43

any variables like in memory or whatever

play09:45

that stuff is going to be gone because

play09:47

you just ran a script and it should be

play09:49

done but here it's not really done

play09:51

because we have access to all these

play09:53

things you have access to f here and you

play09:55

have access to x

play09:58

and if you wanted to you could run a

play10:00

loop for i

play10:01

in range 4 and we will just do print i

play10:06

so you could do that and then you could

play10:08

change a variable maybe make a new

play10:10

variable we'll say

play10:12

lst is equal to just a list of 4 5 6

play10:17

and then each time we will go in at lst

play10:20

dot append with i so we can do that and

play10:24

firstly well what's that gonna do it

play10:26

prints the same thing but lst down here

play10:29

you can see now

play10:30

four five six zero one two three we

play10:33

modified that variable and what you

play10:35

could do is just remove this line and

play10:37

then you could do it again and what that

play10:40

does is it appends to that list it kept

play10:42

the same one because you didn't

play10:43

redeclare it it kept that same one and

play10:46

then it appended four more things and

play10:48

you could do that again and again if you

play10:50

wanted to and that's going to keep

play10:51

growing of course you wouldn't really

play10:53

want to do something exactly like that

play10:55

but the point is to display the fact

play10:57

that we have these variables in memory

play10:59

you're not just running a script top to

play11:01

bottom everything's deleting you are

play11:03

modifying these variables and this is

play11:05

very useful for data science and machine

play11:06

learning because often you're like

play11:08

manipulating a pandas array and you

play11:10

might want to do some things here or

play11:11

there and keep it in memory and look at

play11:13

it later

play11:14

and you might want to train a model and

play11:16

then you know do something for 10

play11:18

minutes just like you know figure some

play11:20

things out and then you know maybe use

play11:22

that model or tweak some things now you

play11:24

can upload and download files into this

play11:26

environment but just be a little bit

play11:28

wary that

play11:30

it's an online resource that's you're

play11:32

not really dedicating and you don't have

play11:34

full access to so just because you

play11:36

upload a file here for example

play11:38

there is no guarantee that if you were

play11:40

to look an hour later or even five or

play11:43

ten minutes later that that file is

play11:44

still going to be there because uh your

play11:47

resources could get washed up at any

play11:49

point however downloading can be

play11:50

extremely powerful because you know once

play11:53

you do something on here download it

play11:55

that file will be on your computer you

play11:57

know until something you know wrong or

play11:59

you deleted on purpose happens if you

play12:01

wanted to to kind of combat that issue

play12:02

you could mount your drive here permit

play12:04

this notebook access to your google

play12:06

drive files so what's saying here

play12:08

connecting to google drive will permit

play12:09

code executing this notebook to modify

play12:11

files in your google drive until access

play12:13

is otherwise revoked so you could have

play12:15

that access to your google drive

play12:17

therefore you're not really going to

play12:18

lose files actually it puts it in right

play12:20

there

play12:21

that way you're not really going to lose

play12:22

files because you can just

play12:24

you can move them to and from your

play12:26

google drive and then you don't really

play12:28

have to worry about that to be honest i

play12:30

scarcely use this i mostly upload things

play12:33

and then you know what they're usually

play12:35

on my computer saved no matter what and

play12:37

if i need to re-upload it again i will

play12:39

re-upload it again

play12:41

and if i need to download something i

play12:43

will quickly download that and then not

play12:45

worry that it's going to disappear

play12:46

because i've already saved a file of

play12:48

that

play12:49

so usually i don't actually do this and

play12:51

i don't remember the complexities on how

play12:53

that involves but it's not super bad

play12:56

there are some helpful tutorials out

play12:57

there if you want to learn about

play12:59

mounting your google drive just so you

play13:01

know some of the complexities of this

play13:03

occasionally you will run out of ram and

play13:05

if so it's probably going to crash and

play13:07

you'll lose most of your results if that

play13:09

happens you'll probably just have to

play13:10

connect to a runtime again and you're

play13:12

probably good to go

play13:13

sometimes things are going to just look

play13:15

like they're going to go forever and

play13:17

then you go to cancel them so for

play13:19

example i could do something like fur i

play13:21

in range of a very very big amount and i

play13:25

will show you what happens we'll try to

play13:26

print i but it's not going to be

play13:28

actually i'm not going to print anything

play13:29

i'm just going to do pass this will

play13:31

irritate it eventually this will

play13:32

probably figure out that it's not going

play13:34

to work

play13:35

but for us what we want to do is try and

play13:37

stop it that did stop it and so you're

play13:40

lucky that it got keyboard interrupt and

play13:43

you're good to go

play13:44

and this does not kill that most the

play13:46

time this does not kill your environment

play13:48

by the way we should still have our

play13:50

previous variables in x right here but

play13:53

not always there will be times for sure

play13:55

when even if you click stop here

play13:58

you know it's doing something

play13:59

complicated and it's not going to want

play14:01

to stop so what if that does happen you

play14:04

can try to do run time interrupt

play14:06

execution try to keep interrupting it

play14:08

and if not you are going to have to

play14:10

restart runtime which is going to fix

play14:12

your problems

play14:13

and maybe disconnect and delete runtime

play14:15

but most the time i usually don't click

play14:17

this one i usually start i usually do

play14:20

restart runtime if there's any big

play14:22

issues and then you'll just run the

play14:24

cells by hand or if you wanted you could

play14:26

do a run all as well but be careful

play14:28

about the run all because the very last

play14:30

thing that ran into a problem would

play14:33

probably run into a problem again yeah i

play14:35

mean it depends what your variables are

play14:37

and how you have kind of the order in

play14:39

which you did things but be wary of the

play14:41

run all because you might just run into

play14:43

the same problem again and again okay

play14:44

sorry i don't have the camera turned on

play14:46

because i'm doing this the next day i

play14:48

can't believe i forgot that if you need

play14:50

a new environment that does not exist

play14:52

already so for example import scikit

play14:54

learn we do that with import sk learn

play14:57

that works okay it doesn't have any

play14:59

problem with that because scikit-learn

play15:01

is installed into the library and

play15:03

actually we can see what is installed

play15:05

with pip and then list that's going to

play15:07

show you all the different environments

play15:09

all of this stuff exists in there

play15:10

already so it has tensorflow sql scikit

play15:13

learn so i can learn pandas scipy a lot

play15:16

of different libraries mostly for data

play15:18

science and machine learning related

play15:19

stuff if there is one that is not

play15:21

installed already and there is tons of

play15:23

them you can do

play15:25

pip install and then whatever that

play15:28

library is so one example of something

play15:30

that's not in there by default is auto

play15:32

sklearn so i will try to do import auto

play15:35

sklearn like that that is how you do it

play15:37

if you looked up the documentation they

play15:39

would tell you how to import it it's

play15:40

like that except that doesn't work

play15:42

there's no module named that and so we

play15:44

need to do the pip install and so you

play15:46

would look up how to do that you'd look

play15:48

up how to do pip and then look at the

play15:50

documentation online for that specific

play15:52

library they would tell you in this

play15:53

specific case pip install auto dash

play15:57

sklearn so i'm going to run that it's

play15:59

going to go and download that and

play16:01

sometimes depending on what happens if

play16:03

it's using libraries that are already

play16:05

installed and messing around with the

play16:07

versions of those as we'll see we saw

play16:09

scipy and scikit-learn in here probably

play16:11

desk is there as well if it does that it

play16:14

may tell you at the end what you'll see

play16:16

here after all of this stuff sometimes

play16:19

is it will tell you to restart the

play16:21

runtime and that is only the case if it

play16:23

is involving libraries that have already

play16:25

been installed so as you can see here it

play16:27

sort of installed scipy uninstalled

play16:29

other versions it does some weird stuff

play16:31

and so it will say you must restart the

play16:33

runtime in order to use the newly

play16:35

installed versions and so if i were to

play16:37

do import autos qlearn it still doesn't

play16:39

like that it actually gives a different

play16:41

error message about versions what you

play16:43

can do to fix that in this case is run

play16:45

time and then we will do restart runtime

play16:47

that clicks yes and after that's

play16:49

restarted you should be able to not do

play16:52

the pip install again you should just be

play16:53

able to import it and you can see this

play16:55

time it worked properly so not always

play16:57

will you have to restart the runtime but

play16:59

sometimes you will sometimes you can

play17:01

just pip install library and then you

play17:03

can import it right away other times you

play17:04

have to restart the runtime but that's

play17:06

how you get new python libraries and if

play17:08

you did need to get a different version

play17:10

specifically you have a different

play17:11

library say that you specifically wanted

play17:13

to pip install numpy equals equals 1.18

play17:19

and you could try and do that and if

play17:20

there is a specific version like that

play17:22

it'll get the point zero by default

play17:24

numpy equals 1.18 or whatever version of

play17:28

whatever specific library you wanted it

play17:30

may have trouble with that depending on

play17:32

the other versions of other things and

play17:34

again you may have to restart the

play17:36

runtime as well to use those new

play17:37

installed versions but if you wanted a

play17:39

specific version you would do it like

play17:40

that and if you wanted a new library you

play17:43

could also get the newest version of

play17:44

something with pip install dash dash

play17:47

upgrade and then numpy what that will do

play17:49

is try its best to get the most

play17:51

up-to-date numpy or whatever library

play17:54

version and again it may have difficulty

play17:56

with other things again it might not

play17:58

like other libraries because of the way

play18:00

that pip

play18:01

in python works but you can try and do

play18:03

it like that i hope this was helpful and

play18:05

drop a like if it was maybe consider

play18:07

subscribe to the channel if you're not

play18:09

subscribed already and i'll see you next

play18:10

time guys

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Google ColabPython CodeJupyter NotebooksInteractive PythonMachine LearningData ScienceCloud ComputingGPUTPUPython Libraries