Install & Compatibility
Where this runs
tested against v0.9.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 5.526s · 399.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 16.5s · import 5.312s · 383MB
402MB installed
● package 402MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Weibull_Distribution
✓ from reliability.Distributions import Weibull_Distribution
Fit_Weibull_2P
✓ from reliability.Fitters import Fit_Weibull_2P
plot_points
✓ from reliability.Probability_plotting import plot_points
This quickstart demonstrates how to create a Weibull distribution, draw random samples, fit a 2-parameter Weibull distribution to the data, and then plot both the probability plot and the survival function using the library's object-oriented approach.
import matplotlib.pyplot as plt
from reliability.Distributions import Weibull_Distribution
from reliability.Fitters import Fit_Weibull_2P
# Create a Weibull Distribution object
dist = Weibull_Distribution(alpha=30, beta=2)
# Draw 20 random samples
data = dist.random_samples(20, seed=42)
plt.figure(figsize=(10, 5))
plt.subplot(121)
# Fit a 2-parameter Weibull Distribution to the samples
fit = Fit_Weibull_2P(failures=data, show_probability_plot=True)
plt.title('Weibull Probability Plot')
plt.subplot(122)
# Plot the survival function from the fitted distribution
fit.distribution.SF()
plt.title('Survival Function')
plt.tight_layout()
plt.show()
Debug
Known issues
breakingThe API and functionality can change significantly between minor versions. For instance, version 0.8.1 is noted to be 'significantly different' from more recent versions. Users should consult the latest documentation when upgrading.fixAlways refer to the official documentation for the specific version being used. Test code thoroughly after upgrading.
affects: Prior to 0.9.0 (e.g., 0.8.1 to 0.9.0)
gotchaPlotting functions in `reliability` are built upon `matplotlib`. To display plots, you must explicitly import `matplotlib.pyplot` and often call `plt.show()` after generating plots. Expecting plots to appear automatically without this setup is a common mistake.fixEnsure `import matplotlib.pyplot as plt` is present and `plt.show()` is called to render plots, especially in scripts.
affects: All versions
gotchaThe library primarily uses an object-oriented paradigm where distributions are first instantiated as objects (e.g., `Weibull_Distribution`), and then methods are called on these objects for operations like sampling, fitting, or plotting. Users accustomed to a purely functional style (like parts of `scipy.stats`) might initially miss this pattern.fixEmbrace the object-oriented design: create a distribution object, then use its methods (e.g., `dist.random_samples()`, `fit.distribution.SF()`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'reliability'
The 'reliability' library is not installed in your current Python environment.
fixpip install reliability
ValueError: Failures and suspensions arrays must be 1D arrays of floats or integers. Cannot be empty.
A distribution fitting function (e.g., Fit_Weibull_2P) received empty arrays or arrays with non-numeric data for its required inputs like 'failures' or 'right_censored'.
fixEnsure all input arrays for fitting functions are non-empty, 1D arrays containing only numeric (float or integer) values.
AttributeError: 'Fitted_Weibull_Distribution_2P' object has no attribute 'gamma'
You attempted to access the 'gamma' (location) parameter from a 2-parameter Weibull distribution fit object, which only provides 'alpha' (scale) and 'beta' (shape).
fixAccess only 'alpha' and 'beta' for a 2-parameter Weibull fit. If a 3-parameter fit including 'gamma' is needed, use `reliability.Fit_Weibull_3P`.
ValueError: The alpha (scale) parameter must be greater than zero.
When initializing a distribution object directly (e.g., Weibull_Distribution), the provided 'alpha' (scale) parameter was zero or negative.
fixEnsure that the 'alpha' (scale) and 'beta' (shape) parameters for distribution objects are positive numbers.
ModuleNotFoundError: No module named 'reliability.Fit_Weibull_2P'
You attempted to import a class or function as if it were a module, rather than importing it from its correct submodule (e.g., `reliability.Fitters`).
fixfrom reliability.Fitters import Fit_Weibull_2P
Upgrade
Version history
0.9.0latest on PyPI · released Mar 7, 2025
Audit
Dependencies
numpyrequiredCore numerical computations and data handling.
scipyrequiredExtends `scipy.stats` for statistical distributions and functions.
matplotlibrequiredRequired for all plotting functionalities.