Hey, folks! In this article, we will learn how to get started with Python Anaconda in this complete Anaconda tutorial. Let’s get started right away!
What is Anaconda in Python?
Anaconda is a free and open-source distribution of Python and R programming for data science and machine learning applications. It has more than 1500 Python/R data science packages.
It comes with tools like Spyder and Jupyter notebook which are used by beginners to learn Python as they are really easy and convenient to use.
Anaconda makes package management and deployment simpler. It creates a virtual environment which makes it easy to deploy any project.
Steps to Install Latest Anaconda Version on Windows
Go to this link and download the latest version of anaconda suitable for your computer. https://www.anaconda.com/products/individual
1. Run the setup and click next
2. Choose file location
Keep in mind to install anaconda to a directory path that does not contain spaces or Unicode characters.
3. Complete the setup
You can choose whether to add Anaconda to your PATH environment variable. It is recommended not to add Anaconda to the PATH environment variable since this can interfere with other software.
You can register Anaconda as your default Python unless you plan on installing and running multiple versions of Anaconda or multiple versions of Python.
In my case, I am going to move ahead with the default settings to demonstrate the installation.
Now, go to the Anaconda command prompt and enter ‘jupyter notebook’. It will open the jupyter notebook dashboard for you.
Adding packages to Python Anaconda
Over 250 packages are automatically installed with Anaconda and more than 75,00 open source packages can be aditionally installed using conda install command.
1. Using conda-forge
To install packages using conda-forge command, run the following syntax in anaconda command prompt:
conda install -c conda-forge PACKAGENAME
conda install -c conda-forge numpy
2. Using pip command
To install packages using the pip command, run the following syntax in the anaconda command prompt:
pip install PACKAGENAME
pip install pandas
Understanding Virtual Environment
Python is a versatile language and can be used for anything. For example Data analysis, Machine learning, Artificial Intelligence or Web development, etc. Each of these tasks requires different packages and versions of Python.
To use these packages and versions efficiently, we use a virtual environment.
It allows each project to have its own dependencies and we can easily switch between applications regardless of what dependencies and requirements they have.
Conda is one such package manager and environment manager included in anaconda.
Now, lets set up the virtual environment using conda interface.
1. Check if conda is installed in your path
Open the Anaconda command prompt and enter the following code:
2. Update conda environment
Run the following command to update the Python Anaconda environment.
conda update conda
3. Create virtual environment
conda create -n envname python=x.x anaconda
Replace envname with the name you want to give to your virtual environment and x.x with the Python version you want to use.
Enter y to proceed
You can search the list of available python versions by entering the following code:
4. Activate the virtual environment
Enter the given command in anaconda command prompt
conda activate envname
Replace envname with the your given environment name.
To see the list of avaiable environements, enter conda info -e command
5. Steps to Install additional packages
Enter the given command after replacing envname with your given environment name and PACKAGENAME with the package you want to install.
conda install -n envname PACKAGENAME
6. Steps to deactivate the virtual environment
To end the session and come out of the environment :
7. Steps to delete the virtual environment
Replace envname with your given name and delete the virtual environement.
conda remove -n envname -all
In this tutorial we learned, how to download and setup anaconda for python. We understood how easy it is to install packages and setting up the the virtual environment. With tons of packages, anaconda provides prime support and efficient results. Hope you all enjoyed, stay tuned!