{"id":26240,"date":"2024-05-03T04:58:10","date_gmt":"2024-05-03T04:58:10","guid":{"rendered":"https:\/\/linuxways.net\/?p=26240"},"modified":"2024-05-03T04:58:10","modified_gmt":"2024-05-03T04:58:10","slug":"install-pip-use-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/install-pip-use-on-ubuntu-24-04\/","title":{"rendered":"How to install Pip and Use on Ubuntu 24.04"},"content":{"rendered":"<p>To install the application on any of the Linux distributions like Ubuntu 24.04 its setup file is required which can be a compressed or deb file. These files are used with package managers to complete the installation and there are several package managers divided based on their functionality. Pip is a package manager for Python programming language, responsible for installing and managing the applications written in Python.<\/p>\n<p><strong>Outline:<\/strong><\/p>\n<ul>\n<li><a href=\"#post-26240-_os8hqe1men1\">How to Install Pip on Ubuntu 24.04<\/a><\/li>\n<li><a href=\"#post-26240-_w6q3xbk41qwx\">Through Ubuntu Default Package Installer<\/a><\/li>\n<li><a href=\"#post-26240-_sjsafuxt4ict\">Through Python Script<\/a><\/li>\n<li><a href=\"#post-26240-_tfpnhv6cvtw3\">Through Pipx Package Installer<\/a><\/li>\n<li><a href=\"#post-26240-_uj46o9kwhfha\">How to Use Pip on Ubuntu 24.04<\/a><\/li>\n<li><a href=\"#post-26240-_8tuji258toyd\">Listing all the Installed Packages<\/a><\/li>\n<li><a href=\"#post-26240-_5x8zt6ydbqjy\">Searching for Packages<\/a><\/li>\n<li><a href=\"#post-26240-_6575ieo3tg9y\">Creating a Python Virtual Environment<\/a><\/li>\n<li><a href=\"#post-26240-_kldpkchzzam5\">Installing Packages via pip<\/a><\/li>\n<li><a href=\"#post-26240-_vqao1jmmw7y1\">Updating Python Packages via pip<\/a><\/li>\n<li><a href=\"#post-26240-_eyar7ydtusoo\">Listing User installed pip Packages<\/a><\/li>\n<li><a href=\"#post-26240-_obrdoe21xnx\">Installing Multiple Packages with pip<\/a><\/li>\n<li><a href=\"#post-26240-_x1x785mqcyf2\">Checking Installed Package Info<\/a><\/li>\n<li><a href=\"#post-26240-_1osjn75urft\">Conclusion<\/a><\/li>\n<\/ul>\n<h2><a id=\"post-26240-_os8hqe1men1\"><\/a>How to Install Pip on Ubuntu 24.04<\/h2>\n<p>The preferred installer program or pip is primarily used for libraries and packages that don&#8217;t come with the standard Python library. Furthermore, pip enables the users to incorporate external modules in their Python code resulting in adding some extra functionality. To install pip on Ubuntu 24.04 there are three ways which will explained briefly:<\/p>\n<h3><a id=\"post-26240-_w6q3xbk41qwx\"><\/a>1: Through Ubuntu Default Package Installer<\/h3>\n<p>Most of the packages on Ubuntu can be installed via apt so to install pip on Ubuntu by using its default package installer execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> python3-pip<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"804\" height=\"386\" class=\"wp-image-26271\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-1.png 804w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-1-300x144.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-1-768x369.png 768w\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" \/><\/p>\n<p>To confirm the installation verify the version by executing the version command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"181\" class=\"wp-image-26274\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-2.png 808w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-2-300x67.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-2-768x172.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/p>\n<h3><a id=\"post-26240-_sjsafuxt4ict\"><\/a>2:Through Python Script<\/h3>\n<p>Another way to install pip for Python is by using its script file which can be <a href=\"https:\/\/pip.pypa.io\/en\/stable\/installation\/\">downloaded from its official site<\/a>. To download the script file, click on the <a href=\"https:\/\/bootstrap.pypa.io\/get-pip.py.\">bootstrap link<\/a>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"874\" height=\"479\" class=\"wp-image-26285\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-3.png 874w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-3-300x164.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-3-768x421.png 768w\" sizes=\"auto, (max-width: 874px) 100vw, 874px\" \/><\/p>\n<p>Alternatively, you can use the terminal to download the file by using its download link along with wget utility:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>bootstrap.pypa.io<span class=\"sy0\">\/<\/span>get-pip.py<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"376\" class=\"wp-image-26296\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-4.png 805w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-4-300x140.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-4-768x359.png 768w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/p>\n<p>Now if you directly install pip using Python and the script file you will get an error of eternally-managed-environment. This error arises to avoid conflict between the system package manager and the Python package manager.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"432\" class=\"wp-image-26306\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-5.png 800w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-5-300x162.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-5-768x415.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>To fix that issue a Python virtual environment is to be created as it will no longer be affected by the system&#8217;s default package installer. Here for illustration, I have created my home directory as a virtual environment, you can change it as per your preference:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">python3 <span class=\"re5\">-m<\/span> venv <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linux<\/div><\/div>\n<p>Here, the m flag specifies the given directory as the virtual environment:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"163\" class=\"wp-image-26310\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-6.png 805w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-6-300x61.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-6-768x156.png 768w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/p>\n<p>Now activate the virtual environment directory by using the source command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">source<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linux<span class=\"sy0\">\/<\/span>activate<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"182\" class=\"wp-image-26317\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-7.png 802w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-7-300x68.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-7-768x174.png 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/p>\n<p>If the downloaded file is in another directory then move the file to the virtual environment directory and then execute the below command to install pip:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">python get-pip.py<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"798\" height=\"492\" class=\"wp-image-26337\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-8.png 798w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-8-300x185.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-8-768x474.png 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/p>\n<p>To confirm the installation, verify the version by executing the version command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"806\" height=\"189\" class=\"wp-image-26369\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-9.png 806w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-9-300x70.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-9-768x180.png 768w\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" \/><\/p>\n<h3><a id=\"post-26240-_tfpnhv6cvtw3\"><\/a>3: Through Pipx Package Installer<\/h3>\n<p>The pipx is also a package manager for Python that uses the isolated environment for installing Python non-Debian packages, unlike pip. So to install pip via pipx you do not need to create a virtual environment just execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pipx <span class=\"kw2\">install<\/span> pip<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"804\" height=\"305\" class=\"wp-image-26378\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-10.png 804w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-10-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-10-768x291.png 768w\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" \/><\/p>\n<p>While installing you will get a warning for the PATH environment variable which means that your current directory is not in the PATH variable. By adding the directory you can launch the application without specifying its path, to add the directory use the <em>ensurepath<\/em> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pipx ensurepath<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"804\" height=\"279\" class=\"wp-image-26387\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-11.png 804w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-11-300x104.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-11-768x267.png 768w\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" \/><\/p>\n<p>To confirm the installation, verify the version by executing the version command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"225\" class=\"wp-image-26391\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-12.png 808w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-12-300x84.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-12-768x214.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/p>\n<p><strong>Note: <\/strong>There was another method for installing pip on Ubuntu which used the ensurepip module. However, the ensirepip module is now disabled for the Debian\/Ubuntu systems:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">python <span class=\"re5\">-m<\/span> ensurepip<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"806\" height=\"325\" class=\"wp-image-26403\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-13.png 806w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-13-300x121.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-13-768x310.png 768w\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" \/><\/p>\n<h2><a id=\"post-26240-_uj46o9kwhfha\"><\/a>How to Use Pip on Ubuntu 24.04<\/h2>\n<p>The pip package installer simplifies the process of installing, updating, and removing Python applications. It also ensures smooth workflow by handling the version management and dependencies, further to use it effectively here are some basics for using pip on Ubuntu 24.04:<\/p>\n<h3><a id=\"post-26240-_8tuji258toyd\"><\/a>1: Listing all the Installed Packages<\/h3>\n<p>By installing pip, several different packages come pre-installed which can be checked by listing all the Python packages installed via pip:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 list<\/div><\/div>\n<p>This list includes both user-installed and pre-installed packages by pip:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"806\" height=\"306\" class=\"wp-image-26408\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-14.png 806w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-14-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-14-768x292.png 768w\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" \/><\/p>\n<h3><a id=\"post-26240-_5x8zt6ydbqjy\"><\/a>2: Searching for Packages<\/h3>\n<p>If you are looking to install any specific Python package, then you can search for it by manually <a href=\"https:\/\/pypi.org\/search\/?q=blinker&amp;o=\">visiting the pip official site<\/a>. Previously, the packages were allowed to be searched by using the search command along with pip:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 search enter_search_term<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"804\" height=\"195\" class=\"wp-image-26413\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-15.png 804w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-15-300x73.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-15-768x186.png 768w\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" \/><\/p>\n<p>Here for illustration, I have searched for Python blinker package:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"466\" class=\"wp-image-26423\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-16.png 975w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-16-300x143.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-16-768x367.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/p>\n<h3><a id=\"post-26240-_6575ieo3tg9y\"><\/a>3: Creating a Python Virtual Environment<\/h3>\n<p>To use pip on Ubuntu, it is necessary to have a virtual environment, as it can cause aunty issues with the system default package installer. If you want to install any Python package without creating a virtual environment the pipx would be the preferable choice. To create the Python virtual environment, first create a directory using <em>mkdir<\/em> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">mkdir<\/span> <span class=\"sy0\">&lt;<\/span>diretory-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>Here I have created a directory named venv_pip :<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"197\" class=\"wp-image-26429\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-17.png 800w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-17-300x74.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-17-768x189.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Now to create the virtual environment you have to install virtualenv utility on Ubuntu first using the apt package manager:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> python3-virtualenv<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"801\" height=\"262\" class=\"wp-image-26442\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-18.png 801w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-18-300x98.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-18-768x251.png 768w\" sizes=\"auto, (max-width: 801px) 100vw, 801px\" \/><\/p>\n<p>Now create the virtual environment in that newly created directory using the <em>virtaulenv<\/em> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> virtualenv <span class=\"sy0\">&lt;<\/span>directory-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"335\" class=\"wp-image-26448\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-19.png 803w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-19-300x125.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-19-768x320.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<p>Now active the virtual environment using the source command along with its path for bin folder:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">source<\/span> <span class=\"sy0\">&lt;<\/span>directroy-name<span class=\"sy0\">&gt;\/<\/span>bin<span class=\"sy0\">\/<\/span>activate<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"194\" class=\"wp-image-26454\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-20.png 803w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-20-300x72.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-20-768x186.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<p>To leave the virtual environment, use the deactivate command<\/p>\n<h3><a id=\"post-26240-_kldpkchzzam5\"><\/a>4: Installing Packages via pip<\/h3>\n<p>The installation of any Python package or library is similar to that of using another package manager. Use the below syntax for installing the Python packages via pip:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 <span class=\"kw2\">install<\/span> <span class=\"sy0\">&lt;<\/span>Name-of-python-package<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"301\" class=\"wp-image-26469\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-21.png 805w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-21-300x112.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-21-768x287.png 768w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/p>\n<p>Alternatively, you can also use the Python3 interpreter to invoke the pip module for installing Python packages:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">python3 <span class=\"re5\">-m<\/span> pip uninstall matplotlib<\/div><\/div>\n<p>If you want to install any specific version of Python application then use the below syntax:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 <span class=\"kw2\">install<\/span> <span class=\"re2\">Enter_Package_Name<\/span>==<span class=\"sy0\">&lt;<\/span>version-number<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>Here, i have installed the older version of numpy:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"377\" class=\"wp-image-26483\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-22.png 881w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-22-300x128.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-22-768x329.png 768w\" sizes=\"auto, (max-width: 881px) 100vw, 881px\" \/><\/p>\n<p>Similarly, to remove any Python package using pip execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 uninstall Enter_Package_Name<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"345\" class=\"wp-image-26490\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-23.png 803w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-23-300x129.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-23-768x330.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<h3><a id=\"post-26240-_vqao1jmmw7y1\"><\/a><strong>5: Updating Python Packages via pip<\/strong><\/h3>\n<p>Sometimes you might experience performance or compatibility issues with any of the installed Python packages, so in that case try updating the package by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 <span class=\"kw2\">install<\/span> <span class=\"re5\">--upgrade<\/span> Enter_Package_Name<\/div><\/div>\n<p>Here, as in the image below, I had an older version of numpy installed which I updated using the above syntax:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"347\" class=\"wp-image-26498\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-24.png 881w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-24-300x118.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-24-768x302.png 768w\" sizes=\"auto, (max-width: 881px) 100vw, 881px\" \/><\/p>\n<p><strong>Note:<\/strong> If you are using pip in the virtual environment for the first time, then you might encounter the permission error named <em>could not install packages due to an OSError<\/em>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"302\" class=\"wp-image-26503\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-25.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-25.png 715w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-25-300x127.png 300w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>To resolve this error simply change the ownership of the following directory to the current user and while doing that do not add the last given folder as it is not created yet which in my case is numpy:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">chown<\/span> <span class=\"re5\">-R<\/span> <span class=\"re1\">$USER<\/span> <span class=\"sy0\">&lt;<\/span>directory-path<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<h3><a id=\"post-26240-_eyar7ydtusoo\"><\/a>6: Listing User installed pip Packages<\/h3>\n<p>To filter out the system package and the pre-installed package, use the freeze command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 freeze<\/div><\/div>\n<p>This command will list the packages along with their versions<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"296\" class=\"wp-image-26507\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-26.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-26.png 803w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-26-300x111.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-26-768x283.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<h3><a id=\"post-26240-_obrdoe21xnx\"><\/a>7: Installing Multiple Packages with pip<\/h3>\n<p>In Python-based projects there is a file named requirements.txt which is used to keep the record of user-installed packages via pip. Furthermore, this file can also be used to install multiple Python packages in one go for that first open up the file in the editor:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">nano<\/span> requirements.txt<\/div><\/div>\n<p>Next, enter the names of the packages correctly and then save the file:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"187\" class=\"wp-image-26509\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-27.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-27.png 882w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-27-300x64.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-27-768x163.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/p>\n<p>Now execute the requirements file to install all the packages:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 <span class=\"kw2\">install<\/span> <span class=\"re5\">-r<\/span> requirements.txt<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"879\" height=\"408\" class=\"wp-image-26512\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-28.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-28.png 879w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-28-300x139.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-28-768x356.png 768w\" sizes=\"auto, (max-width: 879px) 100vw, 879px\" \/><\/p>\n<p>Another purpose of the requirements file is that it can be used to save the data for user-installed packages which can be utilized in any other project. So to add the user-installed Python packages to the requirements file execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 freeze <span class=\"sy0\">&gt;<\/span> requirements.txt<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"879\" height=\"422\" class=\"wp-image-26515\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-29.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-29.png 879w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-29-300x144.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-29-768x369.png 768w\" sizes=\"auto, (max-width: 879px) 100vw, 879px\" \/><\/p>\n<h3><a id=\"post-26240-_x1x785mqcyf2\"><\/a>8: Checking Installed Package Info<\/h3>\n<p>To access the information about the installed package use the show command which can be useful for greeting the information about its version, author, and installed directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 show Enter_Package_Name<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"801\" height=\"297\" class=\"wp-image-26517\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-30.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-30.png 801w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-30-300x111.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-30-768x285.png 768w\" sizes=\"auto, (max-width: 801px) 100vw, 801px\" \/><\/p>\n<p>Further, if you need extensive help regarding the use of pip package manager, consult its help:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pip3 <span class=\"re5\">--help<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"452\" class=\"wp-image-26519\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-31.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-31.png 803w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-31-300x169.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26240-31-768x432.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<h2><\/h2>\n<h2><a id=\"post-26240-_1osjn75urft\"><\/a>Conclusion<\/h2>\n<p>Pip is a package manager for Python which is primarily used in Python-based projects installing libraries or packages. To install pip on Ubuntu 24.04 there are three ways which include using the default package installer which is one of the preferred methods.<\/p>\n<p>The two other include using pipx package manager and Python script file. To use pip for package installation, you have to create a virtual environment so that there are no issues with the system package manager.<\/p>","protected":false},"excerpt":{"rendered":"<p>To install pip on Ubuntu 24.04 there are three ways which include using the default package installer which is one of the preferred methods.<\/p>","protected":false},"author":113,"featured_media":26532,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-26240","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/26240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=26240"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/26240\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/26532"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=26240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=26240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=26240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}