Python Packages Reference#
This page lists the core packages used in this course and common troubleshooting tips. For complete setup instructions, see the main Python Installation Guide.
Core Packages#
The course uses these packages (automatically installed via requirements.txt):
Essential Python#
numpy - Numerical computing and arrays
matplotlib - Plotting and visualization
scipy - Scientific computing
ipykernel - Jupyter kernel for VS Code
jupyterlab - Jupyter Lab interface
Oceanographic Data Handling#
xarray - N-dimensional arrays and datasets (NetCDF files)
netCDF4 - NetCDF file format support
gsw - Gibbs-SeaWater oceanographic calculations (TEOS-10)
seasenselib - Sea-Bird CNV file processing
Geographic Mapping#
cartopy - Geographic mapping and projections
cmocean - Oceanographic color scales
Data Access & Utilities#
requests - HTTP requests for data download
tqdm - Progress bars for downloads
pytest - Testing framework for assignments
Package Installation#
Packages are installed automatically when you follow the Python Installation Guide. The requirements.txt file contains all necessary packages with compatible versions.
Troubleshooting#
Cartopy/NetCDF4 Installation Issues#
These packages often need system libraries. If installation fails:
Linux:
sudo apt install libgeos-dev libproj-dev libnetcdf-dev # Ubuntu/Debian
macOS/Windows: Use conda instead:
conda install -c conda-forge cartopy netCDF4
VS Code Doesn’t Recognize Environment#
If VS Code can’t find your virtual environment:
pip install ipykernel
python -m ipykernel install --user --name=.venv --display-name "Python (.venv)"
Then restart VS Code and select the kernel.
Exercise-Specific Packages#
Exercise 1: CTD Profile Data#
gsw - TEOS-10 calculations for salinity and temperature
seasenselib - Converting Sea-Bird CNV files to NetCDF
Exercise 2: Bathymetry Mapping#
cartopy - Geographic projections and mapping
cmocean - Ocean-appropriate color scales
requests & tqdm - Downloading bathymetry data with progress bars
Notes and Best Practices#
Always use
requirements.txt: Each exercise includes arequirements.txtfile with tested package versionsPrefer GitHub Codespaces for complex packages (cartopy, netCDF4) to avoid compilation issues
Use conda-forge if installing locally on macOS/Windows for packages requiring system libraries
Expert Tips#
Environment isolation: Each exercise should have its own virtual environment
Package versions matter: Stick to the versions in
requirements.txtfor compatibility with automated testsBackup your environment: Save working configurations with
pip freeze > my-requirements.txt