More

    How To Install PIP Python Package Manager on Linux

    pip is the package installer for Python. It helps us to install packages from the Python Package Index and other indexes. In this guide, we are going to explore How To Install PIP Python Package Manager on Linux.

    Install PIP Linux Using default package manager

    Install PIP On Rocky Linux, Alma Linux, CentOS and RHEL

    Since pip isn’t part of the default RHEL based distributions, we’ll need EPEL repository in order to install pip.

    Once you have added and enabled the EPEL repository, install pip using yum/dnf package manager.

    dnf install epel-release 
    yum install python-pip	#This is for python 2
    yum install python-pip	#This is for python 3

    Install PIP On Debian and Ubuntu

    For Debian based distros like Linux Mint and Ubuntu, we’ll use apt package ,manager to install pip.

    apt install python-pip	#For python 2
    apt install python3-pip	#FOr python 3

    Install PIP on openSUSE

    For SUSE, we’ll use zypper package manager. Zypper is a command-line package manager for installing, updating and removing packages.

    zypper install python-pip	#For Python 2
    zypper install python3-pip	#For Python 3

     

    Install PIP on Arch Linux

    packman package manager is used for Arch Linux.

    pacman -S python2-pip	        #For Python 2
    pacman -S python-pip	        #For Python 3

     

    Install PIP on Linux Using ensurepip

    Python comes with an ensurepip module, which can install pip in a Python environment.

    [technnix@rocky9 ~]$ python -m ensurepip --upgrade
    Defaulting to user installation because normal site-packages is not writeable
    Looking in links: /tmp/tmp0a5fht1p
    Requirement already satisfied: setuptools in ./.local/lib/python3.9/site-packages (68.0.0)
    Requirement already satisfied: pip in ./.local/lib/python3.9/site-packages (23.2)
    WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
    distutils: /home/technnix/.local/lib/python3.9/site-packages
    sysconfig: /home/technnix/.local/lib64/python3.9/site-packages
    WARNING: Additional context:
    user = True
    home = None
    root = None
    prefix = None
    

     

    Use PIP on Linux

    Verify successful installation from the commands above.

    [technnix@rocky9 ~]$ pip3 --version
    pip 23.2 from /home/technnix/.local/lib/python3.9/site-packages/pip (python 3.9)
    

     

    Consult pip help

    To list pip commands, use the following command:

    [root@rocky9 ~]# pip3 --help
    
    Usage:   
      pip <command> [options]
    
    Commands:
      install                     Install packages.
      download                    Download packages.
      uninstall                   Uninstall packages.
      freeze                      Output installed packages in requirements format.
      list                        List installed packages.
      show                        Show information about installed packages.
      check                       Verify installed packages have compatible dependencies.
      config                      Manage local and global configuration.
      search                      Search PyPI for packages.
      cache                       Inspect and manage pip's wheel cache.
      index                       Inspect information available from package indexes.
      wheel                       Build wheels from your requirements.
      hash                        Compute hashes of package archives.
      completion                  A helper command used for command completion.
      debug                       Show information useful for debugging.
      help                        Show help for commands.
    
    General Options:
      -h, --help                  Show help.
      --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
      -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
      -V, --version               Show version and exit.
      -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
      --log <path>                Path to a verbose appending log.
      --no-input                  Disable prompting for input.
      --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
      --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
      --timeout <sec>             Set the socket timeout (default 15 seconds).
      --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
      --trusted-host <hostname>   Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.
      --cert <path>               Path to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information.
      --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
      --cache-dir <dir>           Store the cache data in <dir>.
      --no-cache-dir              Disable the cache.
      --disable-pip-version-check
                                  Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.
      --no-color                  Suppress colored output.
      --no-python-version-warning
                                  Silence deprecation warnings for upcoming unsupported Pythons.
      --use-feature <feature>     Enable new functionality, that may be backward incompatible.
      --use-deprecated <feature>  Enable deprecated functionality, that will be removed in the future.
    

    Install a package using pip

    To install a package using pip, run the following command with the right package name:

    pip install <packagename>

    List packages with pip

    To list the currently installed packages, use the following command:

    pip list
    
    Package                   Version
    ------------------------- --------
    ansible-builder           3.0.0
    ansible-navigator         3.4.0
    ansible-runner            2.3.3
    attrs                     23.1.0
    bindep                    2.11.0
    cffi                      1.15.1
    dbus-python               1.2.18
    distro                    1.8.0
    docutils                  0.20.1
    gpg                       1.15.1
    importlib-metadata        6.2.1
    Jinja2                    3.1.2
    jsonschema                4.18.4
    jsonschema-specifications 2023.6.1
    libcomps                  0.1.18
    lockfile                  0.12.2
    MarkupSafe                2.1.3
    nftables                  0.1
    onigurumacffi             1.2.0
    packaging                 23.1
    Parsley                   1.3
    pbr                       5.11.1
    pexpect                   4.8.0
    pip                       21.2.3
    ptyprocess                0.7.0
    pycparser                 2.21
    PyGObject                 3.40.1
    python-daemon             3.0.1
    python-dateutil           2.8.1
    PyYAML                    6.0.1
    ...

    List Package info using pip

    To display the information about a package, use the following command:

    pip3 show rpm
    
    Name: rpm
    Version: 4.16.1.3
    Summary: Python bindings for rpm
    Home-page: http://www.rpm.org/
    Author: UNKNOWN
    Author-email: [email protected]
    License: GNU General Public License v2
    Location: /usr/lib64/python3.9/site-packages
    Requires: 
    Required-by: 
    

     

    Check this out:

     

     

    Recent Articles

    Related Articles

    Leave A Reply

    Please enter your comment!
    Please enter your name here