Kelvin Smith Library
Have questions?
Learn more about the Center
Python’s functionality is extended through the use of packages—reusable modules of code that can be installed from the Python Package Index (PyPI). These packages provide tools for data analysis, web scraping, machine learning, and countless other tasks relevant to research and instruction.
pip
– The standard Python package installer, used to install and manage packages from PyPI.
venv
– Used to create isolated environments where packages can be installed without affecting the system-wide Python.
conda
– An alternative package and environment manager included with the Anaconda distribution (useful for managing scientific libraries and non-Python dependencies).
To search for packages:
Browse https://pypi.org by keyword or category.
Use the command line:
pip search [package-name] # Deprecated, consider browsing PyPI instead
Use pip install
inside an activated virtual environment:
pip install pandas
To install a specific version:
pip install pandas==1.5.3
To install multiple packages from a requirements.txt
file:
pip install -r requirements.txt
To list installed packages:
pip list
To see details about a specific package:
pip show pandas
Upgrading or Uninstalling
pip install --upgrade numpy
pip uninstall matplotlib
Always install packages inside a virtual environment to avoid dependency conflicts. This allows collaborators or future users to recreate the same environment.
Use requirements.txt
to document dependencies for reproducibility:
pip freeze > requirements.txt