Python PIP

Reading Time: 2 minutes

Last Updated: 7/21/2024

PIP is short for Preferred Installer Program. PIP, is a package manager used to install python modules. Python modules are used to provide additional functionality. Once functionality for a object/class has been created a module holding that code/functionality can be stored as a package. This allows solutions to becomes reusable. This then allows for the development and maintenance of a library of pre built solutions. The modules are stored (generally) either in the form of source material which can build the module, or as a wheel.

A wheel is the standard for packaging the pythonic solution. A wheel is really a TAR archive that uses a specific/uniform layout. Most wheels are going to have elements that provide for the “setup”. This might include a readme, licensing information, and a list of required modules.

There are a number of different wheel types. I am going to describes wheels in a general sense. There might be those that want to argue and split hairs.

* Universal Wheels – Includes a pythonic solution that is universally accepted across python implementations.
* Platform Wheels – A wheel that has components that are specific to a family (ex. ARM) often a specific hardware platform. Often this might be used to “optimize” performance or take advantage of specific features rather that contend with a otherwise generic, or perhaps otherwise suboptimal solution.

PyPi or the Python Package Index is generally the generally accepted repository at large for pythonic solutions. Pip can be configured in a number of ways. The default is for it to pull modules from PyPi. See: PyPi


PIP List

C:\Users\user>pip list
Package         Version
--------------- -------
pip             21.1.1
python-dateutil 2.8.1
pytz            2021.1
setuptools      56.0.0
six             1.16.0
WARNING: You are using pip version 21.1.1; however, version 21.1.2 is available.
You should consider upgrading via the 'c:\program files\python310\python.exe -m pip install --upgrade pip' command.

PIP Upgrade

Please note: That you can use the upgrade call to upgrade other python modules as well, such as pandas, numpy, nxlm … not just pip.

python.exe -m pip install --upgrade pip'
C:\Users\User>pip config set global.disable-pip-version-check true
Writing to C:\Users\User\AppData\Roaming\pip\pip.ini

Config list

C:\Users\user\AppData\Roaming\pip>pip config list
global.disable-pip-version-check='true'
global.index="'http://localhost:8080'"
global.index-url='http://localhost:8080/simple'
global.trusted-host='pypi.org'
pip config set global.disable-pip-version-check true
pip config set global.index http://localhost:8080
pip config set global.index-url http://localhost:8080
pip config set global.trusted-host pypi.org

PIP Upgrade package

Example of how to upgrade the “attrs” package. Note that this does use the install “command”

pip install upgrade --attrs

Where does PIP live in a Windows environment.

This example is for a user based install. Pip places a “pip.exe” file in the Scripts directory

C:\Users\User>where pip.exe
C:\Users\User\AppData\Local\Programs\Python\Python312\Scripts\pip.exe
This entry was posted in Programming, Python. Bookmark the permalink.