Python PIP

PIP is a package management system that installs and maintains Python software packages. Since Python version 3.4, PIP is included by default.

On Windows, you can find PIP in the following folder:


PIP looks for packages on the Python Package Index (PyPI), a repository for Python packages.

Let’s look at a package. Since we are network people, let’s check out the networkparse package. Networkparse makes it easy to work with hierarchical network configuration files. This is the project page:

Pip Networkparse Project Page

Networkparse is well maintained and has good documentation. We can install a package with the pip install command:

pip install networkparse
Collecting networkparse
  Downloading networkparse-1.8.0-py3-none-any.whl (13 kB)
Collecting dataclasses<0.7.0,>=0.6.0
  Downloading dataclasses-0.6-py3-none-any.whl (14 kB)
Installing collected packages: dataclasses, networkparse
Successfully installed dataclasses-0.6 networkparse-1.8.0

I’ll use one of the examples from their documentation. First, we import the package in our code:

from networkparse import parse

We’ll create a variable with a string which represents the running configuration of a Cisco IOS router:

running_configuration = """
hostname R1
no aaa new-model
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
ip cef
no ipv6 cef
multilink bundle-name authenticated
interface GigabitEthernet0/1
 ip address
 duplex auto
 speed auto
 media-type rj45
interface GigabitEthernet0/2
 ip address
 duplex auto
 speed auto
 media-type rj45
router bgp 1
 bgp log-neighbor-changes
 network mask
 neighbor remote-as 2
 neighbor remote-as 3
ip forward-protocol nd
no ip http server
no ip http secure-server
ipv6 ioam timestamp

line con 0
line aux 0
line vty 0 4
 transport input none
no scheduler allocate

We need to parse the configuration and assign it to the “config” variable:

>>> config = parse.ConfigIOS(running_configuration)

Now we can do some cool things. For example, show the IP addresses on all interfaces:

>>> interfaces = config.filter("interface .+")
>>> for interface in interfaces:
	ip_address = interface.children.filter("ip address .*").one()

The above code prints the following messages:

interface FastEthernet0/0
ip address
interface FastEthernet0/1
ip address
interface FastEthernet1/0
ip address

This is a simple example but now you know how you can install packages with PIP.


You have now learned how to use PIP to install packages for Python:

  • How to verify where PIP is located on your computer.
  • How to look for packages on PyPI.
  • How to install packages with PIP.
  • How to use packages in your Python code.

I hope you enjoyed this lesson. If you have any questions, please leave a comment.

Ask a question or start a discussion by visiting our Community Forum