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 in Linux using the Command Line
- Installing Miniconda in Linux using the Command Line
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:
-
Open your terminal or command prompt.
-
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:
shellcd ~
-
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.shellwget 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:
shellwget https://repo.anaconda.com/archive/Anaconda3-2023.07-1-Linux-x86_64.sh
-
Make the installer executable by running the following command:
shellchmod +x Anaconda3-2023.07-1-Linux-x86_64.sh
-
Run the installer using the following command:
shell./Anaconda3-2023.07-1-Linux-x86_64.sh
This will start the Anaconda installation process.
-
Read the license agreement and press
Enter
to continue. -
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. -
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. Typeyes
and pressEnter
to proceed. -
The installation will now begin. This may take a few minutes depending on your system's performance.
-
Once the installation is complete, you will see a message indicating that Anaconda has been installed successfully.
-
Close the terminal or command prompt and open a new one to apply the changes.
-
To verify that Anaconda has been installed correctly, run the following command:
shellconda --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:
-
Open your terminal or command prompt.
-
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:
shellcd ~
-
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.shellwget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
-
Once the download is complete, make the installer executable by running the following command:
shellchmod +x Miniconda3-latest-Linux-x86_64.sh
-
Run the installer using the following command:
shell./Miniconda3-latest-Linux-x86_64.sh
This will start the Miniconda installation process.
-
Read the license agreement and press
Enter
to continue. -
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. -
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. Typeyes
and pressEnter
to proceed. -
The installation will now begin. This may take a few minutes depending on your system's performance.
-
Once the installation is complete, you will see a message indicating that Miniconda has been installed successfully.
-
Close the terminal or command prompt and open a new one to apply the changes.
-
To verify that Miniconda has been installed correctly, run the following command:
shellconda --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:
- Download Conda using the
wget
command. - Make it executable using the
chmod
command. - Run the installer using the
./
command. - Follow the on-screen instructions to complete the installation.
If you have any questions, leave a comment below.