What is anaconda, installation tutorial

server

What is Anaconda

Anaconda: the almighty python of the open source Python ecosystem

Anaconda, this open source behemoth known as the "Chinese Python", is essentially a fully functional and content-rich Python distribution. It not only contains the powerful package management tool Conda, but also pre-installed the Python language itself. There are more than 180 scientific computing-related software packages and their dependent components. The emergence of Anaconda is like presenting a vibrant tropical rainforest to Python developers, in which many key toolkits such as Numpy and Pandas thrive, providing out-of-the-box tools for data analysis, machine learning, scientific computing and other fields. Great support.

Anaconda core components and functions

Conda: As the soul component of Anaconda, Conda is an open source package and environment management system. Its core value is that it can help users easily install, update, and uninstall various software packages and their dependencies in a single computing environment. It can also flexibly switch between different versions and different configuration environments, greatly simplifying Python projects. Difficulties in managing complex dependencies in development and scientific research. Whether you are maintaining multiple project versions on the same machine, or you need to quickly reproduce the research results of others, Conda is an indispensable assistant.

Python: Anaconda is naturally equipped with the official standard Python interpreter, ensuring that users can directly use this general programming language that is widely used in data analysis, artificial intelligence, web development and other fields. Anaconda usually provides multiple Python version choices, allowing users to choose the appropriate version for installation based on project needs or compatibility requirements.

Pre-installed scientific packages: Anaconda comes with a set of carefully selected scientific computing and data analysis software packages, covering from basic mathematical operation libraries (such as Numpy) to advanced data analysis frameworks (such as Pandas), visualization tools (such as Matplotlib), machine Learning libraries (such as Scikit-Learn) and even interactive computing environments (such as Jupyter Notebook) and many other levels. These pre-installed packages not only save users the tedious process of searching and installing one by one, but also ensure the compatibility and stability of each package, creating a complete Python scientific computing ecological environment for users out of the box.

Miniconda: A streamlined version of Conda and Python

For those who prefer a lightweight installation or who only need the basic functions of Conda, Anaconda also provides a streamlined version called Miniconda. Miniconda retains the core components of Conda environment management and Python interpreter, but does not come pre-installed with a large number of scientific computing packages. Users can use the Conda command line tool to install the required software packages on demand according to actual needs, and gradually build a personalized Python environment. Miniconda provides a more flexible option for users who are concerned about installation size, care about a specific package combination, or pursue a high degree of customization.

Whether you want to quickly get into Python scientific computing with a one-stop solution, or you want to have a lightweight, highly customizable Python environment management tool, Anaconda and its streamlined version Miniconda can provide you with strong support. With their powerful Conda package management functions, supplemented by rich pre-installed scientific packages or streamlined basic components, they have become one of the preferred tools for Python developers and scientific researchers.

Anaconda download

Download address: https://www.anaconda.com/download/

Note: Anaconda is cross-platform, with versions for Windows, macOS, and Linux

98d470b7c7d8a38bb21512b4901ca472.png

Anaconda installation

Install Anaconda: Step by step to create a dedicated Python scientific computing environment

  1. When you hold the downloaded Anaconda2-5.2.0-Windows-x86_64.exe installation file, a journey to the palace of Python scientific computing officially begins. Just double-click and the installation wizard will pop up on the screen. At this moment, just click "Next" to leisurely enter the installation process.

    788099171c6ebe035149f9585e5ce515.png

  2. As you move forward, you'll see an "I Agree" option when faced with the license agreement. Undoubtedly, this is the gateway to installation. After confirming that it is correct, happily press the Agree button to continue with the next steps.

    85c41952a867c42c3ed52704dc218d72.png

  3. Next, you will be faced with the choice of "Install for". Here, if your computer is only for one person, no need to worry, just select "Just me". However, if your device is shared by multiple users, then "All Users" will be a better choice to ensure that every user can enjoy the convenience brought by Anaconda. In this example, we select “All Users” and then “Next” to move on.

    9dfb48240e9aa12e13f485c549e88afe.png

  4. At this point, the installation wizard leads you to the "Destination Folder" setting. By default, Anaconda will choose to settle in the "C:\ProgramData\Anaconda2" directory on the C drive. If you have special needs for the storage location, you can customize the path through the "Browse..." button. Since the C drive has plenty of space, we happily accepted the default settings and clicked "Next" again without hesitation.


  5. What you see before you is the "Advanced Options" interface, which makes the settings clear to users who are fluent in English and have relevant knowledge. Here, it is enough to keep the default configuration: first, add Anaconda to the system environment variables to ensure that it is seamlessly integrated into your development environment; second, use the Python 2.7 version by default, which meets the needs of this installation. When everything is ready, click "Install" decisively and wait for Anaconda to take root on your hard drive.

    2c2c04e66c7cde718e832d7a63df8112.png


  6. The installation process is like a silent symphony, with complex decompression and file copying going on silently in the background. Dll and py files of different sizes are placed in the target folder accurately one by one like notes on a musical score. The speed of installation depends on your hardware configuration, especially the performance of your processor and the type of hard drive - solid-state drives are lightning fast, while mechanical hard drives are more stable. At this point, all you have to do is wait patiently for this dance of data to come to an end.

  7. After a long wait, the light finally came. "Installation Complete" will be displayed on the screen, announcing that Anaconda has successfully entered your system. The last step is just to "Next" again to move towards the finishing stage.

    8bbd53d10869c0059faba6760ae9b187.png

  8. At this point, the wizard intimately prompts you to install Microsoft VSCode. This integrated development environment, paired with Anaconda, can further enhance your programming experience. If you want to do this, tap "Install Microsoft VSCode". Otherwise, you can skip this link and go straight to the end.

Finally, the winning "Finish" button pops into view. As for the two check boxes at the bottom of the page, you can decide whether to keep them based on personal preference. After confirming that everything is correct, tap "Finish" to bring the entire installation journey to a successful conclusion.

At this point, Anaconda has been firmly rooted in your computer, ready to go, and ready to help you on your Python scientific computing journey.

e22f0c6761bf99de034590da9c5a0f59.png


anaconda creates virtual environment

Mastering Anaconda: Building and managing a personalized Python environment

After installing Anaconda, we have a powerful tool for creating and managing independent Python environments. The next operation will be carried out on the command line interface, so please start the command line now and prepare to start an environment customization journey.

First, let us step into the virtual environment network Anaconda has carefully weaved for you through the `activate` command. If you just enter `activate` without any additional parameters, the system will guide you to the "base" environment preset by Anaconda. At this point, try typing `python` and you will find that you are in the Python interpreter of the base environment. If you have removed the original Python environment from the system before, the difference now will be more obvious: the Python currently used is no longer the previous version, but the one given by the base environment. Also, the `(base)` identifier at the command line prefix clearly indicates that you are active in this specific environment.

ede801bcf29a28a36aecac42d7b8ee49.png

However, a base environment obviously cannot meet the needs of multiple projects. Next, let's create your own personalized virtual environment. For example, to build a new environment named `python34` that uses version 3.4 of Python (the latest available version in that version series, to be precise), just type at the command line:

```bash

conda create -n python34 python=3.4

```

Or use the equivalent command:

```bash

conda create --name python34 python=3.4

```

7e406e838f224fdbee6555fe2b7dd322.png

With the execution and completion of the command, a customized environment named `python34` was born. Next, we need to enter this new environment, still using the `activate` command, but we need to include the name of the environment we want to switch to:

```bash

activate python34

```

If you can't remember the created environment list at the moment, you can run:

```bash

conda env list

```

6a46ac6ab18d0eab8a4d0296014001f6.png

This command will display all environments managed by Anaconda for easy verification and navigation.

Now that you are in the `python34` environment, you will find that this is a relatively pure space, containing only the Python standard library and no other third-party packages. You might as well verify it: start the Python interpreter and try to import the `requests` module:

```python

>>> import requests

```

As expected, you will encounter a "ModuleNotFoundError" because `requests` has not been installed in the new environment. Next, we'll demonstrate how to add the required packages for this environment.

Exit the Python interpreter (using the `exit()` command), then install `requests` using either of the following commands:

```bash

conda install requests

```

or

```bash

pip install requests

```

After the installation is complete, start the Python interpreter again and try to import `requests`, this time it should go smoothly.

Of course, if you need to uninstall an installed package, such as `requests`, there are also two paths for you to choose from:

```bash

conda remove requests

```

or

```bash

pip uninstall requests

```

20190116151136705.png

To query the list of all installed packages in the current environment, just one sentence:

```bash

conda list

```

Anaconda provides a convenient method for environment backup and reproduction. To export the package configuration information of the current environment to the `environment.yaml` file, execute:

```bash

conda env export > environment.yaml

```

In the future, when you need to rebuild a virtual environment that is exactly the same as the current environment, you only need to rely on this configuration file:

```bash

conda env create -f environment.yaml

```

To sum up, by mastering the following common commands, you can easily control the creation, switching, package management and environment backup of the Anaconda environment:

  • Switch to base environment: `activate`

  • Switch to the learn environment: `activate learn`

  • Create an environment named learn, using Python 3 (latest version): `conda create -n learn python=3`

  • List all environments: `conda env list`

  • Display the package list of the current environment: `conda list`

  • Install the requests package: `conda install requests` or `pip install requests`

  • Uninstall the requests package: `conda remove requests` or `pip uninstall requests`

  • Completely remove the learn environment and all its packages: `conda remove -n learn --all`

  • Update requests package: `conda update requests`

  • Export the current environment configuration to `environment.yaml`: `conda env export > environment.yaml`

  • Create a new environment using the configuration file: `conda env create -f environment.yaml`

These commands may seem numerous, but they are actually logically clear and easy to operate. Through repeated practice, you will be able to control Anaconda at your fingertips with ease and customize the most suitable development environment for your Python project.

How to set anaconda to Chinese

Build your Chinese version of Anaconda experience: Installation and setup guide

1. Install the Chinese version of Anaconda in one step

Looking for the most direct way to make Anaconda present a Chinese interface? Choosing to install the Chinese version of Anaconda is undoubtedly the best solution. Visit the Anaconda official website and you will easily find the official Chinese version installation package. Once downloaded and successfully installed, Anaconda immediately welcomes you on your exploration journey with a friendly native language interface without any additional configuration.

2. The existing English version of Anaconda has made a gorgeous turn

If you already own the English version of Anaconda and don't want to re-download and install it, don't worry, you can also turn it into the Chinese version by adjusting the internal settings. Follow these steps:

1. Start the Navigator: Open the Anaconda Navigator application and enter the "Environments" interface.

2. Select an environment: Among the listed environments, select the one for which you want to modify the language settings and click the edit icon on the right (usually a pencil).

3. Open the terminal: Select "Open Terminal" from the pop-up options, and a new terminal window will open.

4. Install the Chinese extension: Type the following command in the terminal to install the nb_anaconda extension that supports the Chinese interface:

   ```bash

   conda install -c anaconda anaconda-nb-extensions

   ```

5. Activate the extension: After the installation is complete, continue to enter the following command to activate the nb_anaconda extension:

   ```bash

   jupyter nbextensions_configurator enable

   ```

6. Switch to Chinese: Close and reopen Anaconda Navigator. You can now find "Nbextensions" in the drop-down menu on the right. Enable the "French – Language pack for JupyterLab" (French – Language pack for JupyterLab). In fact, the corresponding Chinese language pack should be selected here to implement the Chinese interface.

7. Restart Jupyter: Finally, restart the Jupyter service, and you will be pleasantly surprised to find that Anaconda has been replaced with an elegant Chinese interface.

3. Customized Chinese interface specifically for Jupyter Notebook

If you only focus on converting the Jupyter Notebook part into a Chinese interface, there is no need to change the entire Anaconda settings. You only need to adjust the locale for Jupyter Notebook:

1. Make sure Jupyter is installed: Enter the following command in the terminal to confirm or install Jupyter Notebook:

   ```bash

   conda install -c anaconda jupyter

   ```

2. Generate the configuration file: Run the following command to generate the Jupyter Notebook configuration file `jupyter_notebook_config.py`:

   ```bash

   jupyter --generate-config

   ```

3. Edit the configuration: Navigate to the generated configuration file and look for the line "#c.KernelManager.kernel_cmd". Add the following code snippet below it to set the Chinese locale:

   ```python

import os

os.environ['LANGUAGE'] = 'zh_CN.UTF-8'

   ```

At this point, you have successfully set up the Chinese interface for Jupyter Notebook. Just restart the Jupyter service and the new Chinese interface will appear immediately.

Whether you are installing the Chinese version of Anaconda from scratch, switching languages to the existing English version, or only localizing part of the Jupyter Notebook, this guide has provided you with detailed guidance. Follow the above steps to easily enjoy your personalized Chinese version of Anaconda and Jupyter Notebook experience.