Miniconda is a minimal, lightweight version of Anaconda that includes only the essential packages and the Conda package manager. This makes it an excellent choice for those who want a lean Python environment without the extra bulk of a full Anaconda installation. Miniconda allows you to create isolated environments with specific Python versions and packages, making it easier to manage dependencies and avoid conflicts.
This guide will walk you through the steps to install Miniconda on Ubuntu 22.04.
Step 1 – Update the System
Before installing any new software, it’s good practice to update the package list and upgrade the installed packages to their latest versions. Open a terminal and run the following commands:
apt update -y
apt upgrade -y
Step 2 – Download the Miniconda Installer
Next, download the Miniconda installer script. You can find the latest version of Miniconda on the official Miniconda website. Use wget to download the installer:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Step 3 – Run the Installer
Once you have verified the integrity of the installer, you can run the installer script:
bash Miniconda3-latest-Linux-x86_64.sh
The installer will guide you through the installation process.
Do you accept the license terms? [yes|no]
>>> yes
Miniconda3 will now be installed into this location:
/root/miniconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/miniconda3] >>>
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>>
You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session:
eval "$(/root/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)"
To install conda's shell functions for easier access, first activate, then:
conda init
Thank you for installing Miniconda3!
Step 4 – Initialize Conda
After completing the installation, you need to initialize Conda. This sets up the necessary shell configuration. Run the following commands:
source ~/miniconda3/bin/activate
conda init
- source ~/miniconda3/bin/activate: Activates the Conda environment.
- conda init: Configures your shell to use Conda.
Step 5 – Test the Installation
Close and reopen your terminal, or source your shell configuration file to apply the changes:
source ~/.bashrc
To verify the installation, run:
conda --version
This command should display the installed Conda version, confirming that the installation was successful.
conda 24.4.0
You can also check the Conda configuration details with:
conda info
Output:
active environment : base
active env location : /root/miniconda3
shell level : 1
user config file : /root/.condarc
populated config files :
conda version : 24.4.0
conda-build version : not installed
python version : 3.12.3.final.0
solver : libmamba (default)
virtual packages : __archspec=1=x86_64
__conda=24.4.0=0
__glibc=2.35=0
__linux=5.15.0=0
__unix=0=0
base environment : /root/miniconda3 (writable)
conda av data dir : /root/miniconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /root/miniconda3/pkgs
/root/.conda/pkgs
envs directories : /root/miniconda3/envs
/root/.conda/envs
platform : linux-64
user-agent : conda/24.4.0 requests/2.31.0 CPython/3.12.3 Linux/5.15.0-33-generic ubuntu/22.04 glibc/2.35 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8 aau/0.4.4 c/. s/. e/.
UID:GID : 0:0
netrc file : None
offline mode : False
Step 7 – Update Conda
To ensure you have the latest packages and features, update Conda:
conda update --all
Step 8 – Install Packages with Conda
With Conda installed, you can now install packages easily via conda command. For example, to install pandas, use:
conda install pandas
You can list all installed packages in your Conda environment with:
conda list
When you’re done, you can deactivate the Conda environment with:
conda deactivate
Conclusion
You have successfully installed Miniconda on Ubuntu 22.04. You can now use Conda to manage your Python environments and packages. This lightweight setup is perfect for creating isolated environments for your projects without the overhead of the full Anaconda distribution. Feel free to explore Conda’s documentation to learn more about managing environments and packages. You can now use Miniconda to manage your Python project on dedicated server hosting from Atlantic.Net!