Install & Compatibility
Where this runs
tested against v1.7.0 · 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
✓ 11.4s
301MB installed
● package 301MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SourceSpectrum
✓ from synphot import SourceSpectrum
Main class for defining a source spectrum.
SpectralElement
✓ from synphot import SpectralElement
Main class for defining a bandpass (filter).
Observation
✓ from synphot import Observation
Class to combine source and bandpass and compute photometry.
Basic example of creating a source spectrum and a bandpass, then computing synthetic photometry.
from synphot import SourceSpectrum, SpectralElement, Observation
from synphot.models import Empirical1D, BlackBodyNorm1D
from astropy import units as u
import numpy as np
# Define a simple blackbody source spectrum
bb = BlackBodyNorm1D(temperature=5000)
wave = np.arange(1000, 10000) * u.AA
source_spec = SourceSpectrum(bb, points=wave)
# Define a Johnson V filter
# (Filter throughput data can be loaded from a file or defined manually)
# Example using a built-in filter from specutils or a custom one:
# Here we create a simple Gaussian bandpass for demonstration
from astropy.modeling.models import Gaussian1D
v_filter = SpectralElement(Gaussian1D, mean=5500, stddev=500, points=wave)
# Compute the observation
obs = Observation(source_spec, v_filter)
count_rate = obs.countrate() # counts per second
print(count_rate)
# Compute effective wavelength
eff_wave = obs.effective_wavelength()
print(eff_wave)
Errors
Common errors & fixes
AttributeError: module 'synphot' has no attribute 'SourceSpectrum'
synphot is sometimes confused with the older stsci_package synphot (a different library). The correct package is installed as `synphot`, but import path is `from synphot import SourceSpectrum`.
fixUninstall any old version (`pip uninstall synphot` and then reinstall with `pip install synphot`). Ensure you are using the correct import.
ValueError: The unit 'flam' is not recognized
In older versions, strings like 'flam' were accepted. Since 1.6.0, you must use astropy units.
fixUse `u.erg / (u.s * u.cm**2 * u.AA)` instead of `'flam'`.
ImportError: cannot import name 'BlackBodyNorm1D' from 'synphot.models'
BlackBodyNorm1D was added in version 0.3. Ensure your version is up-to-date.
fixUpdate synphot: `pip install --upgrade synphot`.
Upgrade
Version history
1.7.0latest on PyPI · released Mar 7, 2026
Audit
Dependencies
astropyrequiredCore dependency for units, FITS I/O, and cosmology.
scipyrequiredUsed for interpolation and integration.
numpyrequiredStandard math and array operations.