Installing Matplotlib in Visual Studio Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome back in cool id help in this video tutorial we are going to use matplotlib and numpy packages to create a graphical plot in visual studio code and this kind of a graphical plot is used in data science all these steps are ready in this notepad so we will start from the step one in the step one we have to create one file with the py extension so i'm just opening my visual studio code and now going to create one file so you can give any name of your choice first plot dot py file is created now we have to write some code right here so example code for the plot is ready so this is in notepad i'm just copying this sample code and going to paste in that file in visual studio code here we go so guys you can see there are some unexpected uh indentation spaces there so i am removing that one to avoid some syntax errors okay this is done now i'm going to save this file now going back to this notepad so we are in the step one and we are trying to achieve one error which is module not found error and this will tell no module named matplotlib found why because because we want to make sure that everything is in right direction so open the command palette and type here python interpreter now the first important task we have to select the interpreter and that must be activated once you select it and this is inactivated state you will find that on the left hand side of this blue status bar that interpreter version will appear in my case this is 3.9.1 now guys we are ready to run this python program do the right click and select this option and you will see some activities going on terminal and finally we will get the expected error module not found error and there's a no module with the name matplotlib now we have to install it and then we can move further so guys uh if you are getting if you are using all different kind of packages and the similar kind of message you can see that means you have to install that package now we are at the step two in the step two we are doing some activities to install the matplotlib package now open the command palette again and just open new integrated terminal so here in the visual studio code go to this view command palette and type here create new integrated terminal this is the option click on it so this will open you a fresh integrated terminal in the vs code now guys here we can write some commands so i will tell you what we have to type so before proceeding we have one note if you guys are going to work such kind of packages so you have to create a virtual environment this is recommendation and these such kind of isolation environment reduces many complications that can arise from conflicting packaged versions so to work with matplotlib we are going to create a virtual environment and there is a command that we have to run to create and activate that virtual environment so we are just write this command here and press enter and you will see the prompt then you have to run this second command which will activate the virtual environment here we go press enter and then you will see this line and in the beginning of line we have a the name of the virtual environment in a green color that means this is installed and activated now we have to select it and another important note if you guys are getting the message like activate dot ps1 is not digitally signed then you have to perform some action that you have to change the power shell execution policy okay and this is the command to do that but in our case everything seems fine so we are skipping this step we are not performing this one now moving to step three now we have to select our environment the virtual environment that we have just created in the step two and then we will install our matplotlib package this is the simple way like we have just done it in the step one select interpreter so go to the visual studio code again in the command palette just type python colon select interpreter click on this option and guys you will see the list of the available interpreter among them we have our virtual environment python interpreter setup so just select it within few second visual studio code will prepare the va virtual environment for us and we will be inside the our just created virtual environment and this will appear in this status bar on the left corner now guys we are ready to run our mad plot live installation so we can run this command in this terminal here we go once you press enter the process will start and this is downloading all the important files for the matplotlib and this will take three to four minutes or this can be faster in your case if you have a very good internet speed so i am skipping this step as fast as i can and i will show you the final uh downloading step also this is installing the other important dependencies and now after downloading the complete installation procedure procedure will start first first all packages are downloaded now this is going to install on the system so guys finally you will see a message successfully installed but we are getting one version because we have a lower version which is one unit less than the available version now everything seems good now we can ready to run over this python program do the right click and now select the option run python file in the terminal and this will take three four seconds because you are running first time so this is building the library phone cache and this is preparing for your plot that we are expecting and now we got our plot this is sine wave and this is looking nice so guys this program is working perfectly fine and we got our plot so guys this is the way you can use the matplotlib in visual studio code if you are guys doing uh a lot of work with the matplotlib so definitely i would suggest you have to use visual studio code you will find this is convenient and very lightweight and definitely you will enjoy your work right here in the virgil studio code i hope you guys found this video tutorial relevant and useful please don't forget to subscribe my channel and guys for now thanks for watching cool idea help
Info
Channel: Cool IT Help
Views: 115,717
Rating: undefined out of 5
Keywords: Matplotlib and Visual Studio Code, installing matplotlib in vscode, matplotlib package, visual studio code, how to run python in visual studio code, python extension for visual studio code, python in visual studio 2019, change python version in vscode, vscode-python module not found, select python interpreter vscode, visual studio code python virtualenv, visual studio code download
Id: QYLCXLQo1Sc
Channel Id: undefined
Length: 9min 35sec (575 seconds)
Published: Tue Jan 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.