An Beginners Guide to pip – Python Package Manager

python-tutorials

Introduction to What is pip – Python Package Manager

pip is the package installer/manager for python programming language. pip is used to install python packages from the Python Package Index (PyPI) which is a repository of software for the Python programming language. All the software or projects which are shared by the Python Community can be found on the Python Package Index (PyPI). pip makes it easy to search, install, maintain, upgrade and configure the packages which are available on the Python Package Index.

There are certain set of rules by which you can package your Python code for PyPI listing. These packages which are listed on PyPI can be installed by any of the package manager/installer like pip. pip makes it easy for the programmer to install the required packages from the PyPI and also to use them in their codes.

Installing pip – Python Package Manager

pip comes bundled with your python installer if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org. For further help on pip installation you can follow the Installation Guide here.

Running pip – Python package installer

Pip is simply a command line program, which you can run from your command line prompt. Pip simply adds list of commands to your command line prompt, with which you can use pip commands to install/manage your python packages.

In order to run pip commands simply open your command prompt (I have been using Windows 10) and type in $ pip,  once the command is recognized/pip had been correctly installed this will show the following list commands which you can use with pip to manage the python packages:

A successful run of above $ pip command in the command prompt, confirms that your pip installation is running well. For running any of the pip commands like install, show, list etc you just need to run your command prompt and use below format command. This will execute your pip command as specified.

1
pip <your command> [command options]

Using pip – Python package installer

With pip Python package manager you can do lot many tasks related to python package management. But here we will talk for some of the basic tools only, which will help a programmer to manage the packages of Python from its repository i.e. PyPI and make the package usable in user codes. Following are the list of commands which pip as a python package manager performs:

Installing Python packages

pip as earlier iterated is used to install packages from PyPI repository for Python programming language. The command to run for installation of package is:

1
pip install packagename

The above command will install the stable package from PyPI repository.

1
pip install packagename==1.0.4

The above command will install the package having the specified version.

1
pip install ‘packagename>=1.0.4’

The above command will install the minimal version of the package.

For detailed help on pip install command use below command. This will provide you with the detailed usage.

1
pip install –h

Uninstalling Python packages

The following command will uninstall the python package already installed.

1
pip uninstall packagename

Listing of installed packages

With following commands all the packages which are available for use in python are listed.

1
pip list

In order to find the outdated list of packages following commands are used in pip.

1
pip list – -outdated

Running above command will list all the outdated packages with details of older version and the available latest version.

In order to find the list of packages which are uptodate following commands are required in pip.

1
pip list – -uptodate

Getting Information about the installed packages

Running following command will provide the information about the installed packages.

1
pip show packagename

The above command will show only the summary of the installed packages but in order to get the complete details of the installed packages following commands are required.

1
pip show - -verbose packagename

Searching for a package

With the help of pip search command one can search for the available list of packages matching the search query with its name or summary.

1
pip search packagename

Complete list of all commands

Please note that the commands listed above for pip package installer for python is not the complete set of commands, it’s only a set of commands which are most commonly used by the python programmers. For the complete set of commands and their usages in details follow the pip Reference Guide and pip User Guide.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *