Install & Compatibility
Where this runs
tested against v3.0.14 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✓ 21.4s
448MB installed
● package 448MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TimeSeries
✓ from gwpy.timeseries import TimeSeries
✗ from gwpy import TimeSeries
TimeSeries is not at top level; must import from gwpy.timeseries module.
FrequencySeries
✓ from gwpy.frequencyseries import FrequencySeries
✗ from gwpy import FrequencySeries
Similar to TimeSeries, must use the specific submodule.
Spectrogram
✓ from gwpy.spectrogram import Spectrogram
Spectrogram is in its own submodule; no common wrong import known.
plot
✓ from gwpy.plot import Plot
The plotting module is 'plot' (not 'plots').
Fetch gravitational-wave strain data from GWOSC using a TimeSeries object. Requires internet access. The os.environ.get simulates an optional token.
from gwpy.timeseries import TimeSeries
import os
# Fetch 30 seconds of gravitational-wave strain data from GWOSC
# from the LIGO Hanford detector (H1) during GW170817
h1_data = TimeSeries.fetch_open_data(
'H1', 1187008882, 1187008912, # GPS start and end
sample_rate=4096, # Downsample to 4096 Hz
verbose=True,
token=os.environ.get('GWPY_TOKEN', '')
)
print(h1_data)
print('Data length:', len(h1_data), 'samples')
Errors
Common errors & fixes
ImportError: cannot import name 'TimeSeries' from 'gwpy'
Incorrect import path: trying to import TimeSeries directly from gwpy top-level package.
fixUse 'from gwpy.timeseries import TimeSeries' instead.
OSError: [Errno 22] Invalid argument when opening data file
Often due to file path containing non-ASCII characters or using Windows paths in Linux-style string.
fixEnsure file paths are correct and use raw strings or forward slashes.
ValueError: The given GPS end time is not in the data frame's interval
The requested GPS time range falls outside the available data segment (e.g., detector not operating).
fixCheck the data availability using 'gwpy.segments.DataQualityFlag' or query the data range first.
HTTPError: 401 Unauthorized when accessing NDS2 server
Missing or invalid authentication token for NDS2 data access.
fixObtain a token from LIGO's datafind service and set it as GWPY_TOKEN environment variable, or pass token='your_token' to fetch methods.
Upgrade
Version history
4.0.1latest on PyPI · released Feb 3, 2026
Audit
Dependencies
astropyrequiredAstronomy utilities (e.g., time conversions, coordinates)
h5pyrequiredHDF5 file I/O for GW data formats
numpyrequiredCore numerical array operations
scipyrequiredSignal processing and statistical functions
ligo-segmentsrequiredSegment bookkeeping for gravitational-wave data
matplotliboptionalPlotting and visualization
nds2-clientoptionalAccess to NDS2 servers for LIGO data (optional, alternative to GWOSC)