Install & Compatibility
Where this runs
tested against v1.13.2 · 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.12
✕ build_error
✓ 8.5s
py 3.13
✕ build_error
✕ build_error
260MB installed
● package 260MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
GPRegression
✓ import GPy; model = GPy.models.GPRegression(...)
✗ from GPy import GPRegression
GPRegression is located within the GPy.models submodule, not directly in the top-level GPy package.
RBF
✓ import GPy; kernel = GPy.kern.RBF(...)
✗ from GPy import RBF
Kernels like RBF are found in the GPy.kern submodule.
This quickstart demonstrates how to create a simple Gaussian Process regression model, define a kernel, fit it to some synthetic data, and optimize its hyperparameters using GPy. The example also shows how to print the optimized model parameters.
import GPy
import numpy as np
# 1. Generate some synthetic data
X = np.random.uniform(-3., 3., (20, 1))
Y = np.sin(X) + np.random.randn(20, 1) * 0.05
# 2. Define a kernel (e.g., Radial Basis Function)
kernel = GPy.kern.RBF(input_dim=1, variance=1., lengthscale=1.)
# 3. Create a GP regression model
m = GPy.models.GPRegression(X, Y, kernel)
# 4. Optimize the model's hyperparameters
m.optimize(messages=True, max_iters=100)
# Print optimized parameters
print(m)
# To plot (requires matplotlib):
# import matplotlib.pyplot as plt
# m.plot()
# plt.show()
Debug
Known issues
breakingGPy no longer supports Python 2.x. It explicitly requires Python 3.9 or newer.fixEnsure your environment uses Python 3.9 or a more recent version.
affects: <=1.9.9 (Python 2.x support), >=1.10.0 (Python 3 only)
gotchaOptimization (`m.optimize()`) does not guarantee finding the global optimum for complex models and datasets, and can get stuck in local minima or fail to converge.fixConsider using `m.optimize_restarts(num_restarts=N)` with a sufficient number of restarts, trying different initial parameter values, or increasing `max_iters`. Inspect the objective function carefully.
affects: All versions
gotchaGPy's plotting capabilities rely on `matplotlib`. Issues may arise if `matplotlib` is not installed, or if there are backend conflicts in non-interactive environments.fixInstall `matplotlib` (`pip install matplotlib`). For non-interactive environments, explicitly set a non-interactive backend for `matplotlib` (e.g., `matplotlib.use('Agg')`) before importing `matplotlib.pyplot`. affects: All versions
gotchaGPy's dependency on `numpy` and `scipy` means that version mismatches can sometimes lead to unexpected errors or deprecation warnings, especially with very new `numpy`/`scipy` releases and older GPy versions.fixKeep GPy updated to the latest stable version. If encountering issues, try aligning `numpy` and `scipy` versions with those GPy was tested against (check GPy's `setup.py` or documentation).
affects: All versions, particularly older GPy with newer numpy/scipy
Upgrade
Version history
1.13.2latest on PyPI · released Jul 23, 2024
Audit
Dependencies
numpyrequiredCore numerical operations and array handling.
scipyrequiredScientific computing routines, including optimization and special functions.
matplotliboptionalRequired for built-in plotting functionalities.