
Conda is an environment manager and a package manager that's bundled into a single package. Environments are a desired way of having different versions of the same software on the same computer. They are necessary when different applications depend on different versions of a common dependency. An environment manager, such as Conda, creates different paths for each environment. An environment installs packages into and runs packages from only its path, which is different from the paths of other environments. Hence environments are independent of each other.
Conda distributes with Anaconda and Miniconda packages. In principle, Conda is not Python-specific, but it's commonly used in Python-based applications. Anaconda includes Conda, a Python runtime environment, and many packages useful in data-science applications, such as PyTorch, Transformers, and Numpy. Anaconda saves a lot of time you would spend on installing packages. Hence, projects that require a variety of software tools prefer Anaconda because it's uniquely suited to large projects and exploratory projects.
Unlike Anaconda, Miniconda only includes the most important utility packages that run on top of Conda and Python. It's preferable on projects that require fewer tools and remote servers with storage limitations.
Choose Miniconda if:
This guide explains how to install and use Miniconda on a Vultr Ubuntu server. If you're using Ubuntu 24.04, you may find our dedicated guides on How to Install Miniconda on Ubuntu 24.04.
Before you begin:
This guide uses the example values, user
pythonuserand the home directory/home/pythonuser/, replace all occurrences with your actual user account
To install Miniconda for Ubuntu 22.04, begin by performing a Miniconda download from the official website, selecting the appropriate installer for your system. After downloading, make the script executable and run it using the batch mode (-b option) to skip interactive prompts. Once installed, initialize Conda to activate it in your terminal sessions. Miniconda provides a lightweight and efficient way to manage Python environments on Ubuntu 22.04.
Download the Miniconda installer script
To get the latest installer script, visit the Miniconda downloads page
Two methods are available when installing Miniconda. The default normal installation option requires you to manually accept the license agreement and specify the installation directory. In the second silent installation option, the installer automatically accepts the license agreement and uses the default installation directory.
Depending on your preference, install Miniconda using any of the optional methods below.
Run the installation script
When successful, the installer displays an on-screen message as below:
Press Enter to continue and view the license agreement. Use the Up and Down cursor keys to browse through the agreement. When prompted to accept the license terms, enter yes to proceed
Verify the installation directory:
If you don't specify a location, Miniconda installs to the user's home directory by default. For the user pythonuser, the default installation directory is /home/pythonuser/miniconda3
Press Enter to install Miniconda to your desired directory and verify that the user has write access to it, else the installation breaks
When successful, the installer downloads the compressed files into the installation directory and extracts them. When complete, enter yes to initialize Miniconda
When the installation is complete, end your SSH session and start it again to activate Miniconda
By default, the standard interactive way to install Miniconda involves a process of accepting options. Hence, the interactive method is not suitable for automatic installations using a script, and the batch mode solves this problem. When installing Miniconda on Ubuntu, the -b option runs the installer in batch mode and automatically accepts the license agreement to install Miniconda on your server. Use the method as described in the following steps.
Run the installation script
The above command installs Miniconda to your user home directory. For the user pythonuser, it's installed to /home/user/miniconda3
To install Miniconda to a specific location, such as /var/miniconda, apply the -p option. For example:
When the installation is complete, your output should look like the one below:
To initialize Miniconda, run the activation script
Use the init command to initialize Conda before using it
To start using Miniconda on your server, end your SSH session and start it again to activate the base environment
When Miniconda is successfully installed on the server, the system prompt changes with the (base) variable.
Verify that the system PATH includes the Miniconda directory
Output:
To view the list of programs installed by Miniconda, use conda list as below
To exit the Miniconda environment, deactivate the Conda environment
When Miniconda installs to your user home directory. Delete the directory to start the uninstallation process
Delete the hidden Conda directory
Edit the .bashrc file and delete the following configuration lines
Delete the entire section (the entire block of code between # >>> conda initialize >>> and # <<< conda initialize <<<)
You have uninstalled Miniconda from the server. End your SSH session and log in again to apply changes
In this guide, you have installed Miniconda on a fresh Ubuntu server using two optional installation methods, the regular and batch modes. Then, you uninstalled Miniconda completely from your system after use. For more information about Miniconda, visit the official documentation.
0 Comments
Be the first to comment and share your perspective with the community.