You ask — we answer!

Linux system utilities

Python PIP

PIP, which stands for "Pip Installs Packages", is a package manager for Python.

For Debian and Ubuntu:

sudo apt update && sudo apt -y install python3-pip

For other Linux distributions, check the Python version:

python --version

Python 2.7

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python

Python < 3.7

curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3

If you get an error “ModuleNotFoundError: No module named ‘distutils.cmd’” just install it by the standard way:

sudo apt install python3-distutils

Python >= 3.7

curl https://bootstrap.pypa.io/get-pip.py | python3

Virtual environments

Python-venv

Venv is a method for isolating the application environment from the main system. This is particularly important when working on Linux, where certain parts of the operating system are highly dependent on the installed version of Python. Virtual environments are recommended when you need to maintain different versions of packages and libraries on your computer simultaneously. When working with LeaderGPU servers, virtual environments ensure safe operation with various neural networks and data analysis applications, which are often written in Python.

In most distributions of Python, venv is included. However, if you cannot find this tool in the system, you can install it with one command. For Debian and Ubuntu:

sudo apt install python3-venv

Now we can prepare the directory for the isolated virtual environment:

source test/bin/activate

The prompt string will change from $ to (venv) $. This indicates that you are now in a virtual environment. Any package or Python library installed will only be used inside the created folder and it will not affect the operating system. Let’s check.

Without venv:

which python3
/usr/bin/python

In venv:

which python3
/home/user/test/bin/python3

To exit the virtual environment, simply close the terminal or run the following command:

deactivate

Miniforge

Download the latest Miniforge installer for your system:

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"

Run the installer:

bash Miniforge3-$(uname)-$(uname -m).sh

Follow the prompts to complete the installation. After that you need to disconnect from the server and reconnect using SSH. Next create a virtual environment named pyenv and specify the Python version (for example 3.12):

conda create -n pyenv python=3.12

Activate the new environment:

conda activate pyenv

See also:



Updated: 14.04.2025

Published: 15.05.2024


Still have questions? Write to us!

By clicking «I Accept» you confirm that you have read and accepted the website Terms and Conditions, Privacy Policy, and Moneyback Policy.