How to use JupyterHub

Python AI and Machine Learning for Production and Development How to use the virtual machine for development
15 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
This is a free item
$0.00
د.إ0.00
Kz0.00
ARS$0.00
A$0.00
৳0.00
Лв0.00
Bs0.00
B$0.00
P0.00
CA$0.00
CHF 0.00
CLP$0.00
CN¥0.00
COP$0.00
₡0.00
Kč0.00
DKK kr0.00
RD$0.00
DA0.00
E£0.00
ብር0.00
€0.00
FJ$0.00
£0.00
Q0.00
GY$0.00
HK$0.00
L0.00
Ft0.00
₪0.00
₹0.00
ISK kr0.00
¥0.00
KSh0.00
₩0.00
DH0.00
L0.00
ден0.00
MOP$0.00
MX$0.00
RM0.00
N$0.00
₦0.00
C$0.00
NOK kr0.00
रु0.00
NZ$0.00
S/0.00
K0.00
₱0.00
₨0.00
zł0.00
₲0.00
L0.00
QR0.00
SAR0.00
SEK kr0.00
S$0.00
฿0.00
₺0.00
$U0.00
R0.00
ZK0.00
Already have an account? Log In

Transcript

Hello everyone. Welcome to our new video. In this video I am going to cover the ipython and Jupiter hub. A lot of our products are using ipython environment and Jupiter hub for that. So this video explain you what Jupiter hub is and how it can be used for providing a multi user environment for ipython. So if you go to our products, you'll see we at this point we have Python n machine learning and TensorFlow these two products are making use of Jupiter hub and ipython Okay, in our other videos, you might have seen how to access the ipython environment using Jupiter hub.

In this video I will give you more details about Jupiter hub the more functionality about how Jupiter hub can be used for multi user environment. So by now I assume that you are aware about what ipython is. So ipython basically is, is a web based environment for executing Python based code. And what Jupiter hub what Jupiter is Jupiter is basically a superset of ipython you can say. So ipython got popular for executing Python code via browser. We call it as notebooks.

And then other programming languages like Ruby and so on, they adopted the same approach of using browser and executing the code through the browser as a notebook. And what then what emerged out of that is Jupiter. You Jupiter, if you can call it Okay, so you first search for that On so this is the Jupiter project. And this project is basically an umbrella project which covers giving you a browser based execution environment, not only for Python, but a lot of other programming languages. Here you can see PHP and C sharp and whatnot. Okay, so that is Jupiter.

Now Jupiter doesn't have that. So it gives, you know, it is very versatile and you know, it's very useful, okay. It gives you a lot of flexibility for executing code. But the thing is this Jupiter environment is a single user environment. What I mean is that, let's say you know, you are having one virtual machine and that virtual machine you can you want to use across multiple users. So you know, user a wants to use the Jupiter notebook.

And at the same time user B also wants to use that, okay. Now in that kind of multi user environment, Jupiter hub is not suitable for such environment. So what we have is Jupiter hub. What Jupiter hub does is, you know, it expands Jupiter and provides you a multi user version of your Jupiter notebook. Okay? The way it does is for each user, it will span span a separate process to serve that user, that separate process will execute its own Jupiter.

So you got Jupiter hub, which is you can think of it as a proxy. Okay, proxy between, you know, your request and the Jupiter environment. So for each user, it will span a separate process, and that process will have its own Jupiter process running So that's what Jupiter hub is. Okay, so in our products, we make use of this Jupiter hub to allow you multi user environment. So let's take example of our Python AI and machine learning kit. This AI and machine learning period if you follow our previous videos for this particular product has bought one ipython or Jupiter environment so it is running on this IP for me at this point.

And in our previous videos, we have seen that you know this, we logged in using open to because, by default the virtual machine comes with Ubuntu users. So you can set the password for a boon to user and log in. So for the timing, let me just log out. So by default, you will get this screen and you will see a boon to login using your password and you will get You will get this environment, okay? And you will have all the setup the the code and everything for for going to user. But what if you want to have another user, let's say you know, user XYZ, now x y Zed cannot.

So there are two things. First thing is you want a separate environment for the new user. Okay? Let's, let's call it as you know, Alice, okay. So Alice wants to have its own environment with its own code, its own IPython notebook, which we put to use or some other user should not have access to right. So our virtual environment or virtual machine comes with this functionality wherein you can create that new user and automatically the setup the sample demos and everything, which is part of that particular VM in this case for Python machine learning Kade we got this sample code, okay.

So, when we create a new user, this sample code, we get copied to that new user's home directory. And when that new user logs in, he will get his own environment for for to work on, okay. So, you will have separate multi user environment one two is not going to mess up with Alice, Alice is not going to mess up with a Windows environment, whatever Alice is going to do if he creates a new IPython notebook. By default, a boon to will not be having access to that unless you know we provide access to computers. So so this is the gist of having Jupiter hub through which you can use multi user environment and this is very useful. If you're having a company, for example, and you want to have a single virtual machine for all, let's say 10 users within your company or if you're having an education institute or Training Institute, so, for each student having a separate virtual machine will be expensive and waste of resources.

So you can have one beefy virtual machine, okay, like a gig or 16 gig Ram. And then based on number of users, you are going to have or anticipate, you can create your virtual machine and for each users, then you can span a Jupiter hub will span separate Jupiter ipython notebooks. Okay, so this is says what Jupiter hub is going to do. Now how it is done, how that is done. Let me just show you. So currently I am running a VM already.

That VM has only one user at this point. Okay? So I'm connected to that VM. And this VM is having open to user, that's why I'm able to log in. Okay. Let me open another browser.

So we'll open another browser in this browser. I don't have Alice created as of now. Okay. So what I do is I will try to log in using Alice and since there is no user called Alice, it won't allow me to log in. So let's have it in a incognito window. Okay.

So I got two browsers. Let me close this. I go to browser one is in Firefox. I'm logged in as Ubuntu. Here you can see user is logged Going to here trying to log in as Alice. So we'll use this username Alice, okay.

I don't have any password, the user doesn't exist, we do some random password and it will say invalid username or password because the user doesn't exist. Now, what I'll do is I will connect to the VM through the command prompt, or you can connect through the remote Dexter. Okay, let's connect to it through demotic strong, because that will be available to you readily. So I have connected to the VM through the remote desktop. I assume you have gone through our previous videos on how to connect to your VM through the motek store. I'll open up a terminal over there, though.

At the command prompt. I'm going to run this sudo Add User LS. This will add the user create the group and then it will ask for the password and of course Some password and then it will ask for full name and all those things. I'm just going to hit Enter. And now Alice user is created. Okay, so now the user is created.

Let me go back to the Chrome browser. And over here previously it said invalid user name. What I will do is I'll now try and what it is going to do now is just like for Ubuntu, it created an ipython environment. So for Alice also it will go and span a new process. Here it says spanning the server, right. So what it means is it is creating a separate environment for our users Alice, okay.

And not only it will create the environment, but our virtual machine has the functionality wherein it will go and close The sample codes into the home directory of Alice okay. So if I go back to while the server is getting created okay sometimes you can get this error as well okay because you know, if the server is taking more than 30 seconds then you will get this error okay. But in the mean what I will do is I just go and refresh this you will get this 500 internal error, sometimes okay not all the time how to fix this error is you can go to the or you can go to the home not the token, go to the home, start my server and let's see if it starts this time around. Okay because sometimes spawning the new process can take some time. That may result in some error, some time out, okay?

And you can get that 500 internal error. So you can go back to home screen, try to start it again, that's an option. And you know that the next thing you can do is you can pick on token, request a new API token. So now you have this one. And you can use this token and try to log in. Okay, so so this is how you can get rid of that 500 internal error.

It happens sometimes. So you know, the steps are you go and create a new user using Add User command, and then you log in using that user, if you are logging it for the first time, you might get 500 internal error. In that case, you can click on home. Okay, click on Start server again. And even after that you get an error, you can click on token, create, generate a new token and put that token at the start, okay, in the URL, and then you will be able to log in. Okay, so here you can see that now I'm logged in the user is Alice, I am in a different browser.

And here you will see, again, I have the same environment setup for this user. And this environment is different than this environment. So this is the environment for a boon to in Ubuntu, for example, I had created a folder, okay. So if I go to the home Good to hear you. You can see this on untitled folder which I created. If I go back over here, you don't see that untitled folder.

Now here, let me create another folder. Now currently I'm in Alice I will create a folder or let me create a iPython Notebook Okay. I will call it as Alice notebook. Okay. Now that Alice notebook will not be accessible to So, let me change this from untitled to Alice LS. So, I renamed it and you can see that at the top level, you got Alice notebook.

If I go to one, two, and at the top level if I refresh this one, you won't see Alice not book listed over here, but So this is a separate environment. Okay. So I hope you understood the concept of what Jupiter is and what Jupiter hub is and how you can use it for a multi user environment. So thanks a lot for watching.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.