Install WSL2 on Windows 11 with NVIDIA GPU and Docker Support

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to talk about how to install wsl2 with windows 11. you want to make sure you're using windows 11 with this because this opens up a whole new world of capabilities you're using now official drivers from nvidia and microsoft not beta test rapid release versions so you can you can install it all out of the box with windows it greatly simplifies the install procedure let's get into it okay so let's get this going we're going to essentially be following the nvidia directions that they have here for the cuda on wsl guide first thing i'm going to do that they don't even mention there is we're going to check for updates with windows it says i'm up to date but let's see you're up to date now what's really nice about doing this with windows 11 and you want to do this with windows 11 is the windows insider program you don't have to do the windows insider program it used to be that you did and the windows insider program i found at the level that i had to do for this previously made my computer very unstable and reboot happy which are not good combinations for a machine learning workstation so i'm glad i don't have to do that any further they talk about why wsl wsl2 virtual machines the main app that i want to get out of this is docker so that i can run docker for windows and have access to nvidia gpus so that's what i'm doing here wsl one and two i've worked with wsl one not something i want to go back to so we're gonna stick with wsl 2 because that's the one that works with windows and the driver is a lot more integrated than it used to be and this is really the virtualization that they're giving you what's nice about this is you can set up virtual machines and truly run unix now i might do more of a series of videos on wsl 2. some of you are looking at me like i am oh my gosh running windows machine learning who would who would think but i'm gonna try to take this as far as i can and see really if if this will work okay for me so step one install the nvidia driver for gpu support you just need this driver you will not need to install cuda drivers in your linux subsystem which is awesome and then you definitely you also do not need to install them into so let's click this so here it is we're going to get the cuda driver this is actually already the same kuda driver that i had on this machine already so that rocks because i will tend to want to do some things from windows directly but then also run unix that's going to be my ideal situation this is the gpu that i am running yours may well be different let's keep this large and in charge so we'll search that and we'll agree and download four minutes we'll fast forward and by the way we're just starting this here at 9 26 p.m st louis time so let's see how late jeff stays up installing wsl 2. always a good benchmark all right it's downloaded let's go ahead and run it i just clicked on the button there this might well interrupt my recording i'm upgrading the video driver while screencasting through camtasia what could possibly go wrong here we'll fast forward through this and keep fast forwarding through this this is just installing there the screen goes black hopefully we're still recording i have no idea what you're seeing but well that was awesome that blew camtasia completely out of the water but were installed so let's go ahead and close and let's go back to our instructions we're going to go ahead and launch powershell it doesn't mention running an elevated powershell but so i'll right click it and run as administrator yes all right we have the super power shell so wsl dot exe minus minus install all right installing virtual platform now by default this is going to install ubuntu which is very much what i want to do but you can install other like sent and others as well also this is installing just command line so if you want gui sort of support you're going to be launching jupiter and vs code and others out of it and then hitting them with your browser on the host operating system from windows here we'll go ahead and fast forward this i thought it was going quick but there's a bunch of 0 to 100s it looks like all right the requested operation is successful changes will not be effective until the system is rebooted okay here we are back after a reboot i'm gonna open up powershell again and of course we need super power shell so run as administrator and let's see if this wsl exe upgrade works we'll fast forward through this all right this change will take effect on the next ah you're killing me doesn't sound like i have to reboot the entire computer i'm gonna be double safe i'm gonna reboot the whole thing come back in all right we're rebooted back to powershell super powershell and now you should be able to just do the wsl command okay thought they were installing ubuntu for me but whatever all right so let's follow the instructions here did that let's go ahead and do this from the command line so we're going to do wsl minus l minus o ubuntu debian yes i want ubuntu 2004 that's what most of the machine learning stuff is compatible with as of the writing recording of this video so we're going to do wsl minus minus install and we'll do there we go and it's downloading it so we'll just let this run okay it's getting later 9 53 p.m how many of you think it'll still be 317 when i finish this let me know in the comments when do you think i'll be done okay so at this point umbuntu is installed we can see it here we can also see the version specific one that i installed let's go to the version specific one i always like to know what i'm doing installing this may take a few aha that's what got me before error the virtual machine cannot be started because the required feature is not installed oh hyper-v yes okay so yeah hyper-v i need to install at a hardware level so woohoo another reboot seriously who thinks this is going to actually work before midnight let me know in the comments okay after my latest and greatest reboot let's see if it works so i'm going to launch ubuntu installing this may take a few minutes okay at least it's not bombing okay this is important please create a default unix account this username does not need to match your windows username because everybody likes as many passwords as possible so i'm going to just say jeff and then enter a password that i'm not going to forget all right there's my password okay and they're telling the you the usual things about sudo to run a command as administrator user root use the sudo command that works and we're now in ubuntu and like they mentioned here this looks very handy we can do cd mnt and ls there's all my drives if i want to go to c there's c and that's real handy just to be able to move files between these environments or even probably run them purely on c now if you're going to run things purely on c you might get some permission errors i'm not sure you can actually change the unix level these kind of things over here in fact seeing those question mark question mark question mark those are clearly windows files so doing chmod i don't know how that would work on an ntfs volume certainly something to look out anybody have any advice there please let me know in the comments i'm mostly a linux and mac user but i really do want to see if i can get this working in windows all right and then they have some examples like if you want to run the black shoals option i know that's used in financial option trading so let's go ahead and we're going to install docker so i'm going to do cd just to get back to my home directory and this is my home directory inside of wsl2 not or actually inside of ubuntu not my windows home directory but let me copy this paste that in there and we're going to download docker that is funny wsl detected we recommend using docker for windows recommend but don't don't require poor windows is always the red headed step child in this world but i think we i think it's going to work well so once you know the password it's the one i just created i entered my password and by the way what it's talking about with docker for desktop and windows you can certainly do that and that it and i have docker for windows desktop installed not on this machine but on another one the problem then is you can't use the nvidia gpu if you want to use the nvidia gpu you've got to use wsl so do not follow their very poor advice up there okay so that is set up i suppose if i enter docker it should be there yeah so docker i probably need a pseudo here but docker ps i probably need something else running or we need to set it up to auto auto start i think that's what it might have been telling me up here but let's go ahead and finish the installation so we're going to run this and we'll run this one okay we're just setting up the gpg keys so that we can um download these let's put this in and likewise this so that's all one big command yeah that's all one big command run it like that there we go okay now we're going to update sudo apt that's just making sure we have the latest listings of all of the packages that app get can install and then now we're going to install nvidia docker 2 and off we go okay ah that's why it wasn't responding before that's what i thought it was i was just a little ahead of the ball game on a separate wsl2 window so they want another one of these we can do that so that's the second one these are both running out of the same space i'm pretty sure yeah i can see my other shell there once i actually typed the right command now we're going to start the docker service okay docker has started so let's go over to my other one now i should be able to do docker ps permission denied so you need sudo sudo docker ps nothing running that looks that looks good let's go ahead and run a benchmark we'll run this it's going to pull a docker image for me we're going to run it with gpus that's that's the key sudo even though they didn't have that in the copy paste so sudo docker run unable to find image locally and if you've worked with docker you've seen this this kind of thing a billion times so it's downloading this benchmark docker image all right that is that is awesome so it ran it we pretty much have uh have it working now now do they give me nvidia smi yes awesome and there is my gpu the nvidia a6000 so this works we have nvidia gpu up and running on a windows computer i can use unix and i can use windows side by side this was not that bad this is cool who knows we might we might be using windows a lot more for some of these examples and using it right from linux because that that mirrors how you'll probably run this on the cloud and other things but let me know what do you what do you think you want to see a lot more deeper on ws l2 are you appalled by this running even in windows i actually really like windows i do like the gui and other aspects if it wasn't so reboot happy on installing upgrades that that would be nice but i often solve that just by unplugging the internet from it then it doesn't get any bad ideas from the redmond microsoft mothership so let me know in the comments what would you like to see this see this do the next video i'll probably do is just set up tensorflow and those others but that really follows very much the other the other videos that i have you just literally do pip install and you should be you should be good to go and of course they've got a bunch of other type things that you can do here as well let's run this this is a jupiter notebook that has a capability for wsl too so let's so let's paste that in except we need pseudo up front so it's downloading this jupiter let's fast forward through this because i would like to show you how to have jupiter up and running okay just downloaded it you can see we're running a standard tensorflow docker image and we need to copy one of these i'm gonna go with this okay got that right okay copy that and copy so now let's try this in a browser all right and bingo we now have this this going we can do python 3 poor tensor flow i'm going to just run a quick notebook that i have from my course at horseshoe in deep learning i like running this area here it tells me that the gpu is available and we'll run that ah pandas is not available that's fine how could they not include pandas escalarin okay they're shooting really minimal which is fine gpu is available rock on all right that completes it this is set up i'm gonna probably follow this up with just a more actually using it how i set up local paths how i manage files in the different locations i'll dig a little deeper on permissions and other things maybe also setting up things like the docker container to actually start up automatically and perhaps even starting up a wsl 2 instance automatically as you boot windows these are all things that i would certainly want to be able to do there and look at that 10 36 p.m how many of you thought i was going to take longer to do that you let me know in the comments or were you surprised it even took this long thank you for watching this video and if you're interested in seeing more about wsl2 with windows and how you can use nvidia docker and other applications all on a windows workstation please let me know thank you for watching this video
Info
Channel: Jeff Heaton
Views: 24,929
Rating: undefined out of 5
Keywords:
Id: CO43b6XWHNI
Channel Id: undefined
Length: 16min 26sec (986 seconds)
Published: Wed Apr 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.