How to List Installed Python Packages (2024)

The Pip, Pipenv, Anaconda Navigator, and Conda Package Managers can all be used to generate a simple list of installed Python packages, as well as JSON formatted lists.You can also use the ActiveState Platform’s command line interface (CLI), the State Tool to list all installed packages using a simple “state packages” command. For a complete list of all packages and dependencies (including OS-level and transitive dependencies, as well as shared libraries), you can use the Web GUI, which provides a full Bill of Materials view. Give it a try by signing up for a free ActiveState Platform account.

Before beginning this tutorial on getting a list of installed packages (including those located in site-packages, virtual environments, etc), it’s always a good practice to ensure you have an upto-date version of the Python programming language and the latest version of Pip, Anaconda Navigator and Conda in place.

List Installed Packages with Pip

There are a number of pip commands that you can use to get a list of package names and versions, including outdated packages. For example, both pip list and pip freeze will generate a list of installed packages, just with differently formatted results. Keep in mind that pip list will list ALL installed packages (no matter whether they were installed from the Python Package Index or Github, and no matter whether or not they were installed with the pip install command), while pip freeze will list only pip packages (ie., everything installed by whichever pip version you’re using).

For example:

pip list

Output:

Package Version---------------------------------- ----------absl-py 0.7.0
pip freeze

Output:

absl-py==0.7.0

List Packages in a Console with Pip

To list all installed packages from a Python console using pip, you can utilize the following script:

>>> import pkg_resourcesinstalled_packages = pkg_resources.working_setinstalled_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages])print(installed_packages_list)

Output:

['absl-py==0.7.0', 'adodbapi==2.6.0.7', 'alabaster==0.7.12', 'alembic==1.0.7', 'amqp==2.4.1', 'anyjson==0.3.3',

List Modules in a Console without Pip

To list all installed modules from a python console without pip, you can use the following command:

>>> help("modules")

Note that there are some drawbacks to this approach, including:

  • If there are a lot of installed packages, this method can take a long time to import each module before it can search that module’s path for sub-modules.
  • Python modules that have code outside of an if __name__ == “__main__”: code block, and if user input is expected, may cause the code to enter an infinite loop or hang.

List Installed Packages with Pipenv

The pipenv lock -r command can be used to generate output from a pipfile.lock file in a pipenv environment. All packages, including dependencies will be listed in the output. For example:

pipenv lock -r

Output:

-i https://pypi.org/simplecertifi==2019.11.28chardet==3.0.4idna==2.9requests==2.23.0urllib3==1.25.8

List Installed Packages with Anaconda Navigator

To list installed packages in an Anaconda environment using Anaconda Navigator, do the following:

  • Start the Anaconda Navigator application.
  • Select Environments in the left column.
  • A dropdown box at the center-top of the GUI should list installed packages. If not, then select Installed in the dropdown menu to list all packages.

List Installed Packages with Conda

The conda listcommand can be used to list all packages in a conda environment:

conda list

Output:

# packages in environment at C:\Anaconda2_4.3.1:#_license 1.1 py27_1alabaster 0.7.9 py27_0

Globally vs Locally Installed Packages

For information about generating a list of installed packages globally vs locally, refer to:

How to List Globally Installed Packages vs Locally Installed Packages in Python

List Installed Packages with the ActiveState Platform

To view a list of installed Python packages in your currently active project using the ActiveState Platform, run the following command on the command line:

state packages

The output is a full list of installed packages in your current project:

matplotlibnumpypandasscikit-learnscipy

You can also obtain a complete software bill of materials view of all packages, dependencies, transitives dependencies (ie., dependencies of dependencies), OS-level dependencies and shared libraries (ie., OpenSSL) using the ActiveState Platform’s Web GUI:

How to List Installed Python Packages (1)

The ActiveState Platform automatically builds all Python packages including linked C libraries from source code, and packages them for Windows, Linux and macOS. Because it does it all server-side, there’s no need to maintain local build environments.Try it out by signing up for a free ActiveState Platform account.

How to List Installed Python Packages (2024)

FAQs

How to get list of Python packages installed? ›

The most common method for listing installed Python packages is by using the pip command-line tool. pip is the standard package manager for Python, and it comes pre-installed with Python 3.4 and later versions. We can list installed packages using pip by using the list command.

How to find installed Python modules? ›

To check all the installed Python modules, we can use the following two commands with the 'pip': Using 'pip freeze' command. Using 'pip list command.

How do I find where pip installs packages? ›

Different pip packages may be installed in different places on the same system. Therefore, the best way to find the location of a package is through pip 's show command.

How to install a list of Python packages from a text file? ›

Simply use the command pip install -r requirements. txt in your terminal. This will install all the packages listed in your requirements. txt file.

How do I access packages in Python? ›

To access any module or file from a Python package, use an import statement in the Python source file where you want to access it. Import of modules from Python Packages is done using the dot operator (.). Importing modules and packages helps us make use of existing functions and code that can speed up our work.

Where do installed Python packages go? ›

A Python installation has a site-packages directory inside the module directory. This directory is where user-installed packages are dropped. A . pth file in this directory is maintained, which contains paths to the directories where the extra packages are installed.

How do I find Python installations? ›

Follow the steps below:
  1. Step 1: Open Terminal. You can open Terminal by searching for it in the Start menu and selecting "Terminal"
  2. Step 2: Use the Get-Command Command. In the Terminal window, type the following command: (Get-Command python).Path. Press Enter, and Terminal will reveal the paths where Python is installed.
Aug 25, 2023

How do I access Python modules? ›

You need to use the import keyword along with the desired module name. When the interpreter comes across an import statement, it imports the module to your current program. You can use the functions inside a module by using a dot ( . )

How to check if a package is installed in Python? ›

One alternative approach to check if a Python package is installed is to use the pkgutil module. The pkgutil module provides utilities for working with packages, and specifically includes a find_loader function that can be used to check if a package is installed.

How to check if Python is installed or not? ›

To check if Python is installed on your Windows machine using the Start Menu, follow these steps: Press the Windows key or click on the Start button to open the Start Menu. Type "python". If Python is installed, it should show up as the best match.

How do I list all Python files in a directory in Python? ›

How to List Files in a Python Directory
  • Use os.listdir() to print all files.
  • Use os.walk() to access files deeper into a decision tree.
  • Use the glob module to search by regular expression.
  • Use the pathlib module to generate all path file names.
  • Use the os.scandir() function to return a generator.

How do I list installed packages in pip? ›

With pip, the Python package installer, you can list installed packages using the pip list and pip freeze commands. pip list can filter and display packages by conditions like latest, outdated versions, and those not required by others. pip freeze is useful for creating requirements.

Where does Python look for packages? ›

Python imports work by searching the directories listed in sys. path . So Python will find any packages that have been installed to those locations.

How do I see if pip is installed? ›

How to check if pip is installed on Windows and Mac: In Command Prompt on Windows or Terminal on Mac, type and enter: pip --version . If pip version is shown then it is installed.

How do I find documentation for Python packages? ›

You can use the doc() function whenever needed to get quick help. However, you have a better way to study the packages and libraries located in the Python path — the Python Package Documentation. This feature often appears as Package Docs in the Python folder on your system. It's also referred to as Pydoc.

How do I see all packages installed in VENV Python? ›

If you run pip3 list you will see which packages were copied by the venv command. There should only be 2 right now. (You could also pip3 list -v to show the paths to the packages if you want to confirm their location.) (my-python) $ pip3 list Package Version ---------- ------- pip 18.1 setuptools 40.6.

How to check installed packages in Python Visual Studio Code? ›

In the Python Environments window, select the default environment for new Python projects, then select Packages (PyPI) in the dropdown menu. (PyPI is the acronym for the Python Package Index.) Visual Studio shows the list of packages currently installed in the default environment.

How do I get a list of packages installed in Anaconda? ›

Verify your installation was successful by running one of the following commands: conda list - If Anaconda Distribution is installed successfully, this displays a list of packages installed in your active environment and their versions.

Top Articles
What is an ETF? | BlackRock
How Much Water Should I Drink?
7 C's of Communication | The Effective Communication Checklist
Why Are Fuel Leaks A Problem Aceable
Matgyn
Regal Amc Near Me
Konkurrenz für Kioske: 7-Eleven will Minisupermärkte in Deutschland etablieren
GAY (and stinky) DOGS [scat] by Entomb
What Happened To Father Anthony Mary Ewtn
Tugboat Information
Becky Hudson Free
Santa Clara Valley Medical Center Medical Records
Rapv Springfield Ma
Labor Gigs On Craigslist
Best Nail Salon Rome Ga
boohoo group plc Stock (BOO) - Quote London S.E.- MarketScreener
Sport-News heute – Schweiz & International | aktuell im Ticker
Commodore Beach Club Live Cam
Dirt Removal in Burnet, TX ~ Instant Upfront Pricing
Craigslist Red Wing Mn
TBM 910 | Turboprop Aircraft - DAHER TBM 960, TBM 910
St. Petersburg, FL - Bombay. Meet Malia a Pet for Adoption - AdoptaPet.com
Www.publicsurplus.com Motor Pool
Loft Stores Near Me
Hobby Stores Near Me Now
Pirates Of The Caribbean 1 123Movies
Plaza Bonita Sycuan Bus Schedule
Boston Dynamics’ new humanoid moves like no robot you’ve ever seen
Drying Cloths At A Hammam Crossword Clue
Urbfsdreamgirl
Malluvilla In Malayalam Movies Download
Ice Dodo Unblocked 76
First Light Tomorrow Morning
Mg Char Grill
JD Power's top airlines in 2024, ranked - The Points Guy
How does paysafecard work? The only guide you need
Green Bay Crime Reports Police Fire And Rescue
Hair Love Salon Bradley Beach
Ducky Mcshweeney's Reviews
T&J Agnes Theaters
Tmka-19829
SF bay area cars & trucks "chevrolet 50" - craigslist
9781644854013
Best Restaurant In Glendale Az
Wal-Mart 2516 Directory
Section 212 at MetLife Stadium
Ross Dress For Less Hiring Near Me
Three V Plymouth
Powerboat P1 Unveils 2024 P1 Offshore And Class 1 Race Calendar
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
What Time Do Papa John's Pizza Close
Latest Posts
Article information

Author: Jerrold Considine

Last Updated:

Views: 5783

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Jerrold Considine

Birthday: 1993-11-03

Address: Suite 447 3463 Marybelle Circles, New Marlin, AL 20765

Phone: +5816749283868

Job: Sales Executive

Hobby: Air sports, Sand art, Electronics, LARPing, Baseball, Book restoration, Puzzles

Introduction: My name is Jerrold Considine, I am a combative, cheerful, encouraging, happy, enthusiastic, funny, kind person who loves writing and wants to share my knowledge and understanding with you.