Python Forum
to get a list of pip packages that were installed
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
to get a list of pip packages that were installed
#11
(Jun-23-2022, 10:41 PM)Skaperen Wrote: can it make a flat list of dependencies?
It will give new line display of using poetry show or can also use pip list when activate environment with poetry shell.
Poetry also gives description of what the libraries dos
G:\div_code\pan_env {git}{hg}
poetry show
atomicwrites    1.4.0  Atomic file writes.
attrs           21.4.0 Classes Without Boilerplate
colorama        0.4.5  Cross-platform colored terminal text.
more-itertools  8.13.0 More routines for operating on iterables, beyond itertools
numpy           1.23.0 NumPy is the fundamental package for array computing with Python.
packaging       21.3   Core utilities for Python packages
pandas          1.4.3  Powerful data structures for data analysis, time series, and statistics
pluggy          0.13.1 plugin and hook calling mechanisms for python
py              1.11.0 library with cross-python path, ini-parsing, io, code, log facilities
pyparsing       3.0.9  pyparsing module - Classes and methods to define and execute parsing grammars
pytest          5.4.3  pytest: simple powerful testing with Python
python-dateutil 2.8.2  Extensions to the standard Python datetime module
pytz            2022.1 World timezone definitions, modern and historical
six             1.16.0 Python 2 and 3 compatibility utilities
wcwidth         0.2.5  Measures the displayed width of unicode strings in a terminal
pip just list the libraries and version
G:\div_code\pan_env {git}{hg}
pip list
Package         Version
--------------- -------
atomicwrites    1.4.0
attrs           21.4.0
colorama        0.4.5
more-itertools  8.13.0
numpy           1.23.0
packaging       21.3
pandas          1.4.3
pip             22.0.3
pluggy          0.13.1
py              1.11.0
pyparsing       3.0.9
pytest          5.4.3
python-dateutil 2.8.2
pytz            2022.1
setuptools      60.6.0
six             1.16.0
wcwidth         0.2.5
wheel           0.37.1
To get Python list have to parse it,but i don't see why need that?
Can spend a couple of minute to make to a working Python list.
Redirect to a file pip list > "pip_lst.txt"
Parse it:
pip_lst = []
with open('pip_lst.txt') as f:
    next(f);next(f)
    for line in f:
        pip_lst.append(line.split())

print(pip_lst)
Output:
[['atomicwrites', '1.4.0'], ['attrs', '21.4.0'], ['colorama', '0.4.5'], ['more-itertools', '8.13.0'], ['numpy', '1.23.0'], ['packaging', '21.3'], ['pandas', '1.4.3'], ['pip', '22.0.3'], ['pluggy', '0.13.1'], ['py', '1.11.0'], ['pyparsing', '3.0.9'], ['pytest', '5.4.3'], ['python-dateutil', '2.8.2'], ['pytz', '2022.1'], ['setuptools', '60.6.0'], ['six', '1.16.0'], ['wcwidth', '0.2.5'], ['wheel', '0.37.1']]
Reply


Messages In This Thread
RE: to get a list of pip packages that were installed - by snippsat - Jun-24-2022, 12:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  what pip command can list installed files for a name package? Skaperen 3 2,228 Aug-04-2020, 10:15 PM
Last Post: Skaperen
  pip list available packages Skaperen 16 36,871 Oct-31-2017, 12:36 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020