Updating pip with pip command

Hostnbit

Package installation

$ pip install <package-name>

I’ll never forget this, but somehow.

Package versioned installation

$ pip install <package-name>==<version>

Check pip dependencies

$ pip check
No broken requirements found.

* If there is no problem, it will be displayed as above.

If there is a problem with the dependency, it looks like this.

wagtail 2.6.1 has requirement django-modelcluster<5.0,>=4.2, but you have django-modelcluster 5.0.

View full list of packages

$ pip list

Package                          Version
-------------------------------- ---------
altgraph                         0.16.1
beautifulsoup4                   4.6.0
bottle                           0.12.17
certifi                          2019.6.16
chardet                          3.0.4
coverage                         4.5.4
Django                           2.2.7
django-admin-rangefilter         0.5.1
django-bootstrap-datepicker-plus 3.0.5
django-modelcluster              4.4
django-taggit                    0.24.0
django-treebeard                 4.3
djangorestframework              3.10.2
draftjs-exporter                 2.1.6
future                           0.17.1
html5lib                         1.0.1
idna                             2.8
numpy                            1.16.4
pefile                           2019.4.18
Pillow                           6.1.0
pip                              19.3.1
pycodestyle                      2.5.0
PyInstaller                      3.5
pytz                             2019.1
pywin32-ctypes                   0.2.0
pyxel                            1.2.6
requests                         2.22.0
Rx                               3.0.0b4
setuptools                       40.8.0
six                              1.12.0
sqlparse                         0.3.0
Unidecode                        1.1.1
urllib3                          1.25.3
wagtail                          2.6.3
webencodings                     0.5.1
Willow                           1.1

List of packages that need to be updated (this is useful)

$ pip list -o

Package             Version   Latest    Type
------------------- --------- --------- -----
beautifulsoup4      4.6.0     4.8.1     wheel
certifi             2019.6.16 2019.9.11 wheel
django-modelcluster 4.4       5.0       wheel
django-taggit       0.24.0    1.1.0     wheel
djangorestframework 3.10.2    3.10.3    wheel
draftjs-exporter    2.1.6     2.1.7     sdist
future              0.17.1    0.18.2    sdist
numpy               1.16.4    1.17.3    wheel
Pillow              6.1.0     6.2.1     wheel
pytz                2019.1    2019.3    wheel
pyxel               1.2.6     1.2.8     wheel
Rx                  3.0.0b4   3.0.1     wheel
setuptools          40.8.0    41.6.0    wheel
six                 1.12.0    1.13.0    wheel
urllib3             1.25.3    1.25.6    wheel
Willow              1.1       1.3       wheel

Show only the latest status packages (those that do not require update)

$ pip list -u

Package                          Version
-------------------------------- ---------
altgraph                         0.16.1
bottle                           0.12.17
chardet                          3.0.4
coverage                         4.5.4
Django                           2.2.7
django-admin-rangefilter         0.5.1
django-bootstrap-datepicker-plus 3.0.5
django-treebeard                 4.3
html5lib                         1.0.1
idna                             2.8
pefile                           2019.4.18
pip                              19.3.1
pycodestyle                      2.5.0
PyInstaller                      3.5
pywin32-ctypes                   0.2.0
requests                         2.22.0
sqlparse                         0.3.0
Unidecode                        1.1.1
wagtail                          2.6.3
webencodings                     0.5.1

Show packages by package name == version

$ pip freeze

altgraph==0.16.1
beautifulsoup4==4.6.0
bottle==0.12.17
certifi==2019.6.16
chardet==3.0.4
coverage==4.5.4
Django==2.2.7
django-admin-rangefilter==0.5.1
django-bootstrap-datepicker-plus==3.0.5
django-modelcluster==4.4
django-taggit==0.24.0
django-treebeard==4.3
djangorestframework==3.10.2
draftjs-exporter==2.1.6
future==0.17.1
html5lib==1.0.1
idna==2.8
numpy==1.16.4
pefile==2019.4.18
Pillow==6.1.0
pycodestyle==2.5.0
PyInstaller==3.5
pytz==2019.1
pywin32-ctypes==0.2.0
pyxel==1.2.6
requests==2.22.0
Rx==3.0.0b4
six==1.12.0
sqlparse==0.3.0
Unidecode==1.1.1
urllib3==1.25.3
wagtail==2.6.3
webencodings==0.5.1
Willow==1.1

Convenient to use when outputting to requirements.txt

$ pip freeze > requirements.txt

Package update

$ pip install -U <package-name>

Update pip itself

$ pip install -U pip

Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 706kB/s
Installing collected packages: pip
  Found existing installation: pip 18.0
    Uninstalling pip-18.0:
      Successfully uninstalled pip-18.0
Successfully installed pip-18.1

Bulk installation with requirements.txt

$ pip install -r requirements.txt

Uninstall a package

$ pip uninstall <package-name>

Check the details of each package (version, installation location, etc.)

$ pip show <package-name>

Example)

$ pip show bottle

Name: bottle
Version: 0.12.17
Summary: Fast and simple WSGI-framework for small web-applications.
Home-page: http://bottlepy.org/
Author: Marcel Hellkamp
Author-email: marc@gsites.de
License: MIT
Location: c:\users\[username]\appdata\local\programs\python\python37-32\lib\site-packages
Requires:
Required-by:
Hostnbit

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Menu Title
Scroll to Top