
Install Anaconda on Debian 12 to utilize an open-source distribution of Python and R, designed for data science, machine learning, and scientific computing. Anaconda includes Conda, a powerful package and environment manager, along with various scientific libraries for processing large-scale data and performing advanced computations. It is an ideal platform for building machine learning models and executing complex computations on a server.
This article explains how to install Anaconda on Debian 12 and manage Conda environments to run multiple packages on a server.
Anaconda is not available in the default package repositories on Debian 12. Follow the steps below to download the latest installation script and install Anaconda on your Debian server.
Install all required dependency packages for Anaconda.
Visit the Anaconda repository, and download the latest installation script for Linux. For example, Anaconda3-2024.10-1-Linux-x86_64.sh.
Test the integrity of the downloaded Anaconda installation script.
Verify that the generated hash value matches the installer's SHA256 value in the Anaconda repository similar to the one below.
Run the script using Bash to install Anaconda on Debian server.
Press Enter when prompted to start the installation and review the Anaconda license agreement.
Press Space to review the Anaconda terms of service, and press Q to close the pager.
Enter yes when prompted to accept the license terms and press Enter to install Anaconda to the default location in your user's home directory.
Enter yes and press Enter when prompted to update your shell profile and initialize Conda to activate it in every session.
Your output should be similar to the one below when the installation is successful.
Reload your shell configuration to apply the Anaconda changes.
Verify that your shell prompt changes to the default base Conda environment.
View the installed Conda version.
Output:
View information about the active Conda environment, Python version, and channels.
Your output should be similar to the one below.
If you use an Ubuntu 24.04 server, you can follow this guide to install Anaconda on Ubuntu 24.04 and set up its environment for data science, machine learning, and scientific computing tasks.
Anaconda is installed and available in your active user's home directory with a default base environment. To enable multiple users to use Anaconda and manage Conda environments, create a new dedicated anaconda group, and grant it ownership privileges to the Anaconda installation directory. Follow the steps below to create the anaconda group, add users to the group, and enable read permissions to the Anaconda installation directory.
Switch to your user's home directory.
Create a new anaconda group.
Grant the anaconda group ownership privileges to the Anaconda installation directory.
Grant the owner and the anaconda group full privileges to the Anaconda installation directory.
Add your active user to the anaconda group. Replace linuxuser with your actual user.
Create a new user such as exampleuser.
Add the user to the anaconda group.
Switch to the new user.
Enter the user's password when prompted to log in.
Activate the base Conda environment in the user's session.
Initialize Conda in the user's environment.
Your output should be similar to the one below.
Reload the user's shell configuration to apply the changes.
Verify that your shell prompt changes to the default base Conda environment.
View the installed Conda version to ensure the user can manage Conda environments.
Output:
Press Ctrl + D to switch back to your previous user's session.
Conda environments isolate specific resources including packages, versions, and dependencies for projects on your server. A single Conda environment is active at a time and activating another environment automatically deactivates the active environment. Follow the steps below to create and activate Conda environments to manage specific packages on your server.
Create a new myenv Conda environment.
Enter y and press Enter when prompted to create the myenv environment.
Output:
Activate the myenv environment.
Verify that your shell prompt changes from base to the myenv environment.
Install new packages such as numpy and pandas in the myenv environment.
Update packages in the Conda environment. For example, update the pandas package to the latest version.
Remove a Conda package from the active environment. For example, remove the scipy package.
Enter y and press Enter when prompted to remove the scipy package.
Remove all unused packages including cached tarballs, index cache, logfiles, and temporary files.
Enter y and press Enter to confirm and remove the packages when prompted.
If you receive a file permissions error, ensure that your active user has full privileges to the pkgs subdirectory in the Anaconda installation directory.
Export the active Conda environment to a file such as environment.yml.
Create a new Conda environment such as myenv-2 using the exported environment file.
List all available Conda environments.
Your output should be similar to the one below. The active environment is marked with an asterisk (*).
Jupyter Notebook is an open-source application for interactive computing that uses computational notebooks and supports multiple programming languages. Follow the steps below to install and run Jupyter Notebook as a sample application in the active myenv environment.
Install the latest jupyter package.
List all installed packages in your environment and verify that the jupyter package is available.
Output:
Run the following command to create a sample hello.ipynb Jupyter notebook that outputs a Greetings from Vultr message.
Run the hello.ipynb notebook and write the output to a new hello.nbconvert.ipynb file.
Output:
Print the hello.nbconvert.ipynb file and verify that a Greetings from Vultr! message displays in the outputs cell.
Output:
Deactivate the myenv environment to switch back to the default base environment.
Output:
You have installed Anaconda on a Debian 12 server and set up a Conda environment to manage packages. You can use Conda to create multiple isolated environments to install and manage Python packages based on your project needs. For more information and environment options, visit the Anaconda documentation.
0 Comments
Be the first to comment and share your perspective with the community.