A Tutorial Guide: How to Install Anaconda for Python?
Want to share your content on python-bloggers? click here.
Anaconda Python is a beginner’s friendly platform for people curious to learn Python programming language. It’s easy to install, and you can get started quickly using Jupyter Notebook. It also provides numerous cool features and libraries that you can utilize for your data science and machine learning projects.
Python is one of the most popular versatile programming languages in recent times. It is used in everything from machine learning to building websites and game development. Python is considered the top programming language in TIOBE and PYPL Index.
In this tutorial, we will cover how to install Anaconda for Python, and how to use it to implement your first hello world program. We will also explore some of Python’s essential features so you can kick-start your journey as a Pythonista.
Let’s get started!
What is Anaconda for Python?
Anaconda Python is a free open-source platform that allows you to write and run code in Python programming language. The Anaconda platform is the most popular and widely used for scientific computing, data science, and machine learning. It is used by over 30 million people across the globe and is freely available for Windows, macOS, and Linux.
Anaconda Python also comes with numerous packages and libraries that you can utilize for your projects. Since Anaconda Python is open-source and freely available, anyone can contribute to its development.
How to install Anaconda for Python?
Anaconda is a package manager and Python distribution that contains many open-source packages. When you work on data science projects, you will need to install different packages (NumPy, Scipy, scikit-learn, seaborn name a few), which an installation of Anaconda Python comes preinstalled with.
If you need additional packages after installing Anaconda you can easily install them using conda or pip install those packages.
With that, let’s install the Anaconda for Python!
- Open the Anaconda Website and click on the Anaconda Distribution download option for windows installation. To install for macOS and Linux click on Get Additional Installers and your installation will start.
- Once the downloading is completed, open the downloaded exe file. The below screen will appear; click on Next.
- Read the license agreement and click on the ‘I Agree’ button.
- After that, leave the Just Me (recommended) as it is and click Next.
- Select your installation path and click Next.
- Click on the Next button.
- Finally, click on the Finish button now you have successfully installed Anaconda Python.
- Now you have successfully installed Anaconda Python on your computer along with other essential packages, including Jupyter Notebook, Anaconda prompt, Spyder, and Anaconda Navigator.
How to Install Packages in Anaconda Python?
We use the following command to install the Python package in Anaconda.
pip install name_of_package
Steps to install a Python package in Anaconda
To install the Python package, search Anaconda Prompt in the window search bar and open it. You will see the following screen with your user name.
The pip install package_name can be used to install the Python package in Anaconda. For instance, if we want to install the Python package pandas we will use the below command.
To verify that your package has successfully been installed, enter the following command in the Jupyter notebook.
import pandas as pd
You will get an error message when the package hasn’t successfully installed in your system.
How is Anaconda different from Python?
The main difference between Python Programming and Anaconda is that Anaconda involves the distribution of both Python and R languages, while Python is a high-level, general-purpose programming language.
The below comparison table shows the main differences between Anaconda and Python programming languages.
Fundamental Terms | Anaconda Programming | Python Programming |
Meaning | Open-source distribution of Python and R languages for data science and machine learning. | Open-source that interpreted high-level language for general-purpose programming |
Category | Data Science tools | Computer languages |
Package Manager | Conda | Pip |
Developer | Anaconda Inc. | Guido Van Rossum |
Application | Data Science and ML | Wider usage |
Community | Small community | Large community |
Anaconda Tools
You also install Anaconda Navigator, Conda, and hundreds of other packages when you install Anaconda. This portion will guide you about the tools and why they are beneficial alongside Anaconda.
Anaconda Distribution
Anaconda Distribution is an open-source, easy-to-install package manager, environment manager, and python distribution containing over 720 open-source packages. The repository features over 8,000 open-source data science and machine learning packages. It also supports all major operating systems and architectures.
Conda
Conda is an environment manager and Anaconda package that helps to install, update, and remove packages through a command-line interface. You can utilize it to write your packages and maintain various versions of them in separate environments.
Miniconda
Miniconda is a smaller version of Anaconda containing conda package manager and Python. It is a small bootstrap version that includes conda, Python, and other essential packages such as pip, Zlib, and many more.
Anaconda Navigator
Anaconda Navigator is a graphical user interface that allows you to launch the application and effectively manage conda packages, environments, and channels without using the command prompt.
Spyder
Spyder is a python open source integrated development environment (IDE) that provides many features to work with Python code, such as a text editor, debugger, profiler, and interactive console. Spyder allows the users to create a project which contains many different subfolders or Python scripts.
Jupyter Notebook
Jupyter Notebook is a live web-based application that allows you to create and share documents that contain live code, data visualizations, mathematical equations, and narrative text.
Anaconda Prompt or Terminal
The Anaconda Prompt is a command line interface with Anaconda Distribution. The terminal is also a command line interface that comes with Linux and macOS.
Package
A package is a collection of modules installed by Conda. A module is a Python file that has a .py extension.
How to Use Anaconda for Python
This section will cover how to kick-start coding using Anaconda.
Let’s get started with Anaconda Navigator by launching an application. Then, create and execute a simple hello world program with Spyder and Jupyter Notebook.
You can compare Conda with Navigator to see which one is suitable for managing your packages and environments. You may switch between them, so the work you do on one platform may be seen on the other.
How do you run Python code in the Spyder?
Spyder is one of the most popular Python IDEs and is included in the Anaconda distribution.
To launch the Spyder application, open the Anaconda Navigator and select the Spyder IDE from the list.
Once the Spyder is open, you can write and execute your first Python program in the text editor. For instance, we write the print(“hello world”). Once complete, click File > Save as and name your program with the .py extension. To execute your program click the Run icon or press F11 on your keyboard.
Your program will execute in the interactive console. The result of the program will be displayed in the console in the bottom right corner.
How do you run Python code in Jupyter Notebook?
To launch Jupyter Notebook, open the Anaconda Navigator and choose Jupyter Notebook from the list of applications.
Once the Jupyter Notebook is open, create a new Python file by selecting New > Python from the top right corner. A new Python file will be created, and you can rename it by clicking on the file name.
Now you can write our first program print(“Hello Jupyter Notebook”) on the first line. To run your Python program in Jupyter Notebook, choose the cell to execute, click on the Run button, or press Shift + Enter from your keyboard. Next, the result of your program will be displayed below.
Some Useful Conda Commands
Conda is the most widely used tool to create a virtual environment and manage packages for data scientists using Python.
Figuring out the best way to get Conda on your machine and installing packages from various channels isn’t straightforward. Here, we will guide you on some of the most commonly used Conda commands.
- Creating a new Conda environment
First, you need to do is to create a new Conda environment for your project.conda create -n env_name python=3.6.7
- You will specify the environment name and also the Python version. Conda will create the environment, adding Python 3.6.7 and some other dependencies.
Activate your Conda environment
To activate your conda environment, simply switch into your environment.conda activate environment_name - Seeing what’s in your Conda environment
To see what’s included in the new environment, or to see what’s available in an environment at any time, you can use the below command.
conda list
- Adding new packages to your environment
To add additional packages to your conda environment, for instance, pandas or scikit-learn we use.conda install your_package_name - Here you need to specify the package name you want to add. You can also include the version number of that package.conda install your_package_name=X.Y.Z
- Updating your Conda environment
To update a specific package, for instance, if you want to update seaborn to use a new feature that was not added in the previous version, then we use:conda update your_package_name - To update a specific version of the package, include the version number after the name of the package.conda update your_package_name=X.Y.Z
- Deactivating your Conda environment
To switch between conda environments, or deactivate the environment and return to your standard terminal prompt.conda activate another_environmentTo deactivate completely the environment, we use the below command.conda deactivate
Conclusion
Anaconda Python is a great tool for practicing coding in Python. It contains numerous machine learning and deep learning libraries to kick-start learning these sought-after skills. It is simple to install and comes with many cool features that can help you get started swiftly.
For beginners, it is easy to use a provides a simple user interface. It’s a complete package to build or work on data science and machine learning projects.
Do you want to become a data scientist? Make sure to get in touch to learn how we can help you!
The post A Tutorial Guide: How to Install Anaconda for Python? appeared first on The Data Scientist.
Want to share your content on python-bloggers? click here.