Home//

How to Install Conda using Linux Command Line

How to Install Conda using Linux Command Line

Minh Vu

By Minh Vu

Updated Nov 05, 2023

Conda is a popular package and environment management system that allows you to easily install, manage, and update software packages and dependencies in Python.

In this tutorial, you will learn how to install Conda using only the command line (CLI) in Linux and WSL (Windows Subsystem for Linux).

Table of Contents

Installing Anaconda using the Command Line

To install Conda, you can choose between Anaconda and Miniconda. Anaconda is a full distribution of Conda that includes a wide range of pre-installed packages, while Miniconda is a minimal version that allows you to install only the packages you need.

In this tutorial, we will focus on installing Anaconda using the command line. Here's how you can do it:

  1. Open your terminal or command prompt.

  2. Navigate to the directory where you want to download the Anaconda installer. For example, if you want to download it to your home directory, you can use the following command:

    shell
    cd ~
  3. Download the Anaconda installer using the wget command. You can find the latest version of Anaconda by visiting the Anaconda website. Replace the <VERSION> placeholder with the version number you want to download.

    shell
    wget https://repo.anaconda.com/archive/Anaconda3-`<VERSION>`-Linux-x86_64.sh

    For example, to download Anaconda 2023.07-01, you can use the following command:

    shell
    wget https://repo.anaconda.com/archive/Anaconda3-2023.07-1-Linux-x86_64.sh
  4. Make the installer executable by running the following command:

    shell
    chmod +x Anaconda3-2023.07-1-Linux-x86_64.sh
  5. Run the installer using the following command:

    shell
    ./Anaconda3-2023.07-1-Linux-x86_64.sh

    This will start the Anaconda installation process.

  6. Read the license agreement and press Enter to continue.

  7. You will be prompted to choose the installation location. The default location is usually fine, but you can choose a different location if you prefer. Press Enter to confirm the installation location.

  8. Next, you will be asked if you want to initialize Anaconda3 by running conda init. This step is optional but recommended as it allows you to use Conda directly from the command line. Type yes and press Enter to proceed.

  9. The installation will now begin. This may take a few minutes depending on your system's performance.

  10. Once the installation is complete, you will see a message indicating that Anaconda has been installed successfully.

  11. Close the terminal or command prompt and open a new one to apply the changes.

  12. To verify that Anaconda has been installed correctly, run the following command:

    shell
    conda --version

    You should see the version number of Conda printed on the screen.

Congratulations! You have successfully installed Anaconda using the command line in Linux.

Installing Miniconda in Linux using the Command Line

If you prefer a minimal installation of Conda, you can use Miniconda instead of Anaconda. Miniconda allows you to install only the packages you need, making it a lightweight option.

Here's how you can install Miniconda using the command line:

  1. Open your terminal or command prompt.

  2. Navigate to the directory where you want to download the Miniconda installer. For example, if you want to download it to your home directory, you can use the following command:

    shell
    cd ~
  3. Download the Miniconda installer using the wget command. You can find the latest version of Miniconda by visiting the Miniconda website. Replace the <VERSION> placeholder with the version number you want to download.

    shell
    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  4. Once the download is complete, make the installer executable by running the following command:

    shell
    chmod +x Miniconda3-latest-Linux-x86_64.sh
  5. Run the installer using the following command:

    shell
    ./Miniconda3-latest-Linux-x86_64.sh

    This will start the Miniconda installation process.

  6. Read the license agreement and press Enter to continue.

  7. You will be prompted to choose the installation location. The default location is usually fine, but you can choose a different location if you prefer. Press Enter to confirm the installation location.

  8. Next, you will be asked if you want to initialize Miniconda3 by running conda init. This step is optional but recommended as it allows you to use Conda directly from the command line. Type yes and press Enter to proceed.

  9. The installation will now begin. This may take a few minutes depending on your system's performance.

  10. Once the installation is complete, you will see a message indicating that Miniconda has been installed successfully.

  11. Close the terminal or command prompt and open a new one to apply the changes.

  12. To verify that Miniconda has been installed correctly, run the following command:

    shell
    conda --version

    You should see the version number of Conda printed on the screen.

That's it! You have successfully installed Miniconda using the command line in Linux.

Conclusion

In this tutorial, you learned how to install Conda using only the command line in Linux and WSL.

To recap, these are the steps:

  1. Download Conda using the wget command.
  2. Make it executable using the chmod command.
  3. Run the installer using the ./ command.
  4. Follow the on-screen instructions to complete the installation.

If you have any questions, leave a comment below.

You can search for other posts at home page.
Minh Vu

Minh Vu

Software Engineer

Hi guys, I'm the author of WiseCode Blog. I mainly work with the Elastic Stack and build AI & Python projects. I also love writing technical articles, hope you guys have good experience reading my blog!