
Conda is an open-source tool that performs package and environment management. As a package manager, its functionality relates to any other package management tool such as the pip Python package manager. As an environment manager, it helps to create and manage different environments. Sometimes different applications have different versions of the same software. Managing the different versions is a difficult task, and environments solve this problem. Each environment can host specific software and dependencies, independent of other environments. Conda is available to install as part of either Anaconda or Miniconda.
Anaconda is pre-packaged with a smaller set of Python packages. This makes it the preferred choice for servers with storage limitations. It's also the preferred option in situations that require only a small set of tools. Where Anaconda pre-installs a few hundred common packages such as PyTorch, Transformers, Numpy, and Scipy, Miniconda only installs a few dozen basic utility packages.
Choose Anaconda if:
If your use case does not meet the above requirements, it's better to install Miniconda instead.
In this article, you'll install Anaconda on a Ubuntu 22.04 Vultr server and verify that the tool is available to use on the system. For newer versions, check out our article on How to Install Anaconda on Ubuntu 24.04.
Before you begin, you need to:
This guide uses the example values, user
pythonuserand the home directory/home/pythonuser/, replace all occurrences with your actual user account.
Looking to get started with Anaconda for Ubuntu 22.04? In this guide, we’ll walk you through the steps to install Anaconda in Ubuntu 22.04, making it easy to manage packages and environments for Python-based data science and development projects.
Download the latest Anaconda installer script
The above command adds the Anaconda version 2023.07-2 file to your working directory. To download the latest version, visit the official installer scripts page. A single installer file may have a total file size of up to 1 Gigabyte.
To install Anaconda, there are two available methods, the normal installation where you interactively use the installer application, and the silent installation which requires no user input. Depending on your preferences, the silent installation is fast and does not require any prompts to install Anaconda as described in the sections below.
Run the shell script
When successful, the following prompt should display:
Press Enter to continue and view the License Agreement. To browse through the agreement pager, press the Space button. When complete, enter yes to accept the product license terms
Press Enter to view the installation summary as below:
As displayed in the above output, Anaconda installs to your user home directory, for this guide, it installs to /home/pythonuser/. When logged in as root, the default installation directory is /root/anaconda3
Press Enter to install Anaconda to the default installation directory /home/pythonuser/anaconda3
To install Anaconda to a different directory, manually type the directory path and press Enter to use the directory
When you accept all prompts, all Anaconda files download and extract to the target directory. When complete, the following message displays
To initialize Conda before using it. Type yes and press Enter
When the initialization is successful, Anaconda is ready to use on your system. To activate the application, end your user SSH session
Using SSH, re-establish a connection to your server
When logged in, verify that your terminal prompt includes the Conda (base) environment as below:
If you'd like to disable the Conda base environment whenever you establish a connection to the server, set the activate_base value to false as below:
The default standard Anaconda installation method requires user input to activate the program on your server. Sometimes it's necessary to install Anaconda automatically through a script. In such cases, you don't need to interact with the installer. Run the installer in batch mode to automatically accept the license agreement and install Anaconda as described below.
Run the Anaconda installation script in batch mode -b
When successful, your output should look like the one below:
The command installs Anaconda to the default user home directory /home/user/anaconda3. To install Anaconda to a custom directory, add the -p option to the command. For example:
To initialize Conda for use on the server. Run the activation script
Initialize Conda
Anaconda is now available on the server. End your SSH session and log back in to verify that you can view the activated Conda base environment terminal prompt.
When logged in to the server, verify that your terminal prompt looks like the one below:
View the available user paths
Verify that the PATH output contains the path to the ancillary programs installed by Anaconda and the path to the Conda executable as below:
View the list of programs installed by Anaconda
To deactivate the Conda environment, and re-access the main Linux shell, run the following command
Before you uninstall Anaconda, deactivate the base environment
Delete the Anaconda installation directory
Delete the hidden Conda data directory
To delete the Conda environment variables, edit the .bashrc in your user home directory
Navigate to the end of the file, and delete the following configuration lines
Save and close the file.
End your SSH session
Re-establish an SSH connection to your server
Verify that Anaconda uninstalls from the system, and the (base) environment prompt does not display in your terminal prompt
In this guide, you installed Anaconda on a Ubuntu server using two optional installation methods, normal and silent. You also verified the installation and completely removed Anaconda from the system after use. For more information about Anaconda, visit the official documentation.
To apply more solutions on your cloud server, visit the following resources:
0 Comments
Be the first to comment and share your perspective with the community.