How to List Python Packages - Globally Installed vs Locally Installed (2024)

When a package is installed globally, it’s made available to all users that log into the system. Typically, that means Python and all packages will get installed to a directory under /usr/local/bin/ for a Unix-based system, or \Program Files\ for Windows.

Conversely, when a package is installed locally, it’s only made available to the user that installed it. Locally installed Python and all packages will be installed under a directory similar to ~/.local/bin/ for a Unix-based system, or \Users\Username\AppData\Local\Programs\ for Windows.

How to List Python Packages

As a best practice, you should always install Python and the packages you need into a separate virtual environment for each project. This creates an isolated environment that will avoid many of the problems that arise because of shared libraries/ dependencies.

The Pip Package Manager can be used to list both globally and locally installed Python packages. The Pipenv, Anaconda Navigator and Conda package managers can also be used to list locally installed packages in their respective environments.

Before listing packages, it’s always a good practice to ensure that up-to-date versions of Python, Pip, Pipenv, Anaconda Navigator and Conda are in place.

How to List Python Packages that are Globally Installed

Pip installs packages globally by default. To list globally installed packages and their version # use:

pip list

or

pip freeze

To list a single globally installed package and its version #, use the following command depending on your OS:

Linux:

pip freeze | grep <packagename>

Windows:

pip freeze | findstr <packagename>

How to List Python Packages that are Locally Installed

Pip

Although pip installs packages globally by default, packages that have been installed locally with the --useroption can also be listed using the same --user option, as follows:

pip list --user

or

pip freeze --user

If you just want to list a single, locally installed package and its version #, you can use one of the following commands, depending on your OS:

Linux:

pip freeze --user | grep <packagename>

Windows:

pip freeze --user | findstr <packagename>

Pipenv

To list locally installed packages and their version # within a pipenv environment, cd into a pipenv project and enter the following command:

pipenv lock -r

This command will list all packages installed, including any dependencies that are found in a Pipfile.lock file.

ActiveState Platform

If you prefer to see a visual representation of the packages in your local/virtual environment, you can use the ActiveState Platform’s Web GUI, which shows:

  • Installed top-level packages
  • Installed package dependencies
  • Installed shared (i.e., OS-level) dependencies

How to List Python Packages - Globally Installed vs Locally Installed (1)

Conda

To list locally installed packages and their version # within a Conda environment, open the Anaconda Prompt and enter the following command:

conda list

Anaconda Navigator

To list all installed packages in a local Anaconda environment using Anaconda Navigator, do the following:

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

How to Determine the Location of Globally Installed Packages

As noted earlier, globally installed Python packages can typically be found in the default install location for your OS. However, it is possible to install packages into a non-default directory. In order to determine where global packages have been installed, use the following command:

python -m site

To show the location of globally installed packages in a python console, use the following script:

>>> import site>>> print(site.getsitepackages())'

or

>>> import sys>>> sys.path

Using Pip Show for Package Location

The pip show command can provide information about a single, globally installed package, including its location:

pip show <packagename>

How to Determine the Location of Locally Installed Packages

To list the location of locally installed packages, use the following command:

python -m site --user-site

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 Python Packages - Globally Installed vs Locally Installed (2024)

FAQs

How to List Python Packages - Globally Installed vs Locally Installed? ›

The Pip Package Manager can be used to list both globally and locally installed Python packages. The Pipenv, Anaconda Navigator and Conda package managers can also be used to list locally installed packages in their respective environments.

How do I see globally installed Python packages? ›

To get a list of installed packages in Python, you can use the pip command-line tool with the list command. This will show all packages installed in the current environment.

How to get list of all installed packages in Python? ›

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” ...

How do I list all packages in an environment? ›

List all packages in the current environment:
  1. conda list. List all packages installed into the environment 'myenv':
  2. conda list -n myenv. Save packages for future use:
  3. conda list –export > package-list.txt. Reinstall packages from an export file:
  4. conda create -n myenv –file package-list.txt.

Should you install Python packages globally? ›

Python “Virtual Environments” allow Python packages to be installed in an isolated location for a particular application, rather than being installed globally. If you are looking to safely install global command line tools, see Installing stand alone command line tools.

How do you check what packages are installed globally? ›

How to list installed globally packages? You can list globally installed packages with npm ls --global or npm ls -g . For example, if you use nvm , the output should look something like this. In this example I used npm ls -g --depth=0 to list my global installed packages.

How to check where Python packages are installed? ›

Therefore, the best way to find the location of a package is through pip 's show command.

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

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 do I list all Python environments? ›

To see a list of the Python virtual environments that you have created, you can use the 'conda env list' command. This command will give you the names as well as the filesystem paths for the location of your virtual environments.

How to list all packages in cmd? ›

The Get-Package cmdlet returns a list of all software packages on the local computer that were installed with PackageManagement. You can run Get-Package on remote computers by running it as part of an Invoke-Command or Enter-PSSession command or script.

What packages should be installed globally? ›

Global installation is suitable when a package includes an executable that is intended to be run from the command line interface (CLI) and is shared across multiple projects. For instance, a commonly installed global package is “nodemon,” a tool that automatically restarts a Node. js application after file changes.

What is the most used Python package? ›

Top 30 Python Libraries List
RankLibraryPrimary Use Case
1NumPyScientific Computing
2PandasData Analysis
3MatplotlibData Visualization
4SciPyScientific Computing
26 more rows

What is the most downloaded Python package? ›

Most downloaded PyPI packages
1boto3327,093,926
2urllib3167,314,024
3requests147,196,692
4setuptools141,261,770
5botocore141,188,573
15 more rows

How do I uninstall globally installed Python packages? ›

If you want to delete all the packages installed by PIP, you can use the pip freeze command. It can help you list all the installed packages via PIP and uninstall them without asking for confirmation. The correct type of this command is pip uninstall -y -r <(pip freeze).

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.

Where are my Python libraries stored on my Mac? ›

On macOS 10.8-12.3, the Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python , respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software.

Top Articles
Healthy diet
How To Stay Safe From Gift Card Scams
Riverrun Rv Park Middletown Photos
Safety Jackpot Login
Roblox Roguelike
855-392-7812
Pinellas County Jail Mugshots 2023
Truist Park Section 135
Wells Fargo Careers Log In
Alpha Kenny Buddy - Songs, Events and Music Stats | Viberate.com
The Best Classes in WoW War Within - Best Class in 11.0.2 | Dving Guides
Think Of As Similar Crossword
Ribbit Woodbine
Lesson 1 Homework 5.5 Answer Key
Our History | Lilly Grove Missionary Baptist Church - Houston, TX
Uc Santa Cruz Events
Azeroth Pilot Reloaded - Addons - World of Warcraft
Nexus Crossword Puzzle Solver
Miami Valley Hospital Central Scheduling
Oxford House Peoria Il
RBT Exam: What to Expect
10-Day Weather Forecast for Santa Cruz, CA - The Weather Channel | weather.com
Unity - Manual: Scene view navigation
Kamzz Llc
Hobby Stores Near Me Now
Pasco Telestaff
Magic Seaweed Daytona
Uncovering The Mystery Behind Crazyjamjam Fanfix Leaked
Mandy Rose - WWE News, Rumors, & Updates
BJ 이름 찾는다 꼭 도와줘라 | 짤방 | 일베저장소
Cardaras Funeral Homes
Relaxed Sneak Animations
Criglist Miami
How rich were the McCallisters in 'Home Alone'? Family's income unveiled
Gt7 Roadster Shop Rampage Engine Swap
Renfield Showtimes Near Marquee Cinemas - Wakefield 12
Plato's Closet Mansfield Ohio
Imperialism Flocabulary Quiz Answers
Barber Gym Quantico Hours
Atlanta Musicians Craigslist
Complete List of Orange County Cities + Map (2024) — Orange County Insiders | Tips for locals & visitors
Ig Weekend Dow
M&T Bank
844 386 9815
Wgu Admissions Login
John Wick: Kapitel 4 (2023)
Plumfund Reviews
Paradise leaked: An analysis of offshore data leaks
Verilife Williamsport Reviews
sin city jili
Texas 4A Baseball
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 5753

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.