Install Miniconda (Python) with Jupyter Notebook and Setting Up Virtual Environments on Windows 10

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys in this tutorial i'm going to provide you a quick start to install python virtual environments and jupyter notebook on your windows machine as fast as possible currently i do not have python installed on my machine if i type python in my command prompt it shows that it does not recognize this command to install python we are going to use the distribution of python which is called miniconda to install miniconda head over to their website the link is in the description box down below on the miniconner website choose the latest python version at the time of this recording python 3.8 is the latest version to download here once downloaded open up the installer click on next and confirm the license agreement for the installation type i recommend you to install it for the current user otherwise you might be facing some admin conflicts for the installation path i will leave the default one now this part of the installation process is important if this is your first version of python you're going to install i highly recommend you to tick this box here by adding the path to the python executable you will be able to access python from anywhere in your command prompt you won't need to specify the full path to the python executable which makes your life a lot easier once the installation is done you can shoot up the anaconda prompt by typing anaconda in your windows search bar to validate that the python installation was successful you could type python and press enter you will see a python version and you could even write python code directly in this terminal thanks to the path variable we can also type aware python in our command prompt and it will return the path to the python executable location you might have noticed already the name base in your command prompt this is the current python environment you are in at its core the main purpose of python virtual environment is to create an isolated space for python project this means that each project can have its own dependencies regardless of what dependencies every other project has in simple words imagine you want to install an old windows 95 software on windows 10. there's a high chance that you will face difficulties in the installation process also python and the python libraries are continuously developed further to ensure that your script will work also in the future it is best practice to create a separate virtual environment for each project in this environment you could freeze the current version of python and the libraries you are using for that specific project to make the importance of virtual environments clearer i will show you a practical example as a first step let us create a new environment by typing conda create dash n followed by the name of the environment i will call mine my env you could give it any other name you want in this environment i will install python in my case i will also specify the python version even though we have python 3.8 in our base environment we could go ahead and install an older version like 3.7 if we are taking the previous example it's like installing an older version of windows even though there might be already a newer version available however this is totally optional if you just want to install the latest version in that environment just type it like this confirm the installation of the environment by pressing y on your keyboard whenever you want to work in that environment you need to activate it first to activate the new environment type conda activate and then the name of your environment you will notice that base has now been changed to my anv with pip freeze you could print out the list of the libraries which are currently installed in this particular environment i will go ahead and install the library pandas in our new environment it will install now the latest version of pandas like before we could have also specified a particular version of pannas by typing it like this i will show you in a second why this could be important as the next step i'm using again pip3s you will notice that besides pandas also other libraries have been installed those are the essential dependencies of the pandas library meaning pandas needs those other libraries in order to run to use jupyter notebook first we need to install it by typing pip install jupyter as promised let me showcase you the importance of using virtual environments in the following folder i have an excel file that i want to manipulate with the help of the pandas library in a jupyter notebook a quick tip if you click in the navigation bar and type cmd it will open up the command prompt in this folder first things first i'm going to activate our environment we just have created to open up jupyter notebook type jupyter notebook and press enter a new browser window will pop up and it shows all the files which are located in the current directory to create a new workbook click on new python 3. i will import pandas spd and run the cell by pressing the run button to read the excel file i'm going to use the read underscore excel method and oops we've got an error message it says that it's missing the optional dependency xlrd to fix this i will install the library xlrd in our environment notice that xlt version 2.0.1 has now been successfully installed let's give it another try and run the script again and whoops we've got another error message it says that the version of xlrd equal or higher than 2.0 like in our case only supports xlss formats as we are trying to read an xlsx file we should use even older version of xlrd or use another library called openpi xl this is a perfect example why environments are so important imagine you have done a data analysis project in the past and you were reading in also an xlsx file you might have used an older version of xlrd and everything was just working fine by updating the xlrd library your previous code would not be working anymore now back to our example we could now downgrade the xlrd version in our virtual environment or install open pi xl instead which i'm going to do first let me uninstall xlrd once done i will install open pi excel to tell pandas to use the open pi xl library you could specify the engine in the read excel method and finally after running the script we have created our data frame if you are new to jupyter notebook i would like to show you my favorite five keyboard shortcuts which you can find here those includes running cells as well as changing the cell type from code to markdown markdown is a simple syntax that formats texts headers list boldface and so on i will also link your markdown cheat sheet in the description box down below as the last step i am going to change the name of the notebook up here you could also download the jupyter notebook as a python file by navigating to file download s and selecting python ok guys that's it for this tutorial as always if you have any questions or only trevor support just let me know in the comment sections down below thank you very much for watching and see you next time [Music] bye
Info
Channel: Coding Is Fun
Views: 51,660
Rating: undefined out of 5
Keywords: Miniconda, Python Installation, Virtual Environments, Install Miniconda
Id: XCvgyvBFjyM
Channel Id: undefined
Length: 7min 50sec (470 seconds)
Published: Sat Jan 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.