Environment:Scikit learn Scikit learn Python Runtime Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Machine_Learning |
| Last Updated | 2026-02-08 15:00 GMT |
Overview
Python 3.11+ environment with NumPy, SciPy, joblib, and threadpoolctl as core runtime dependencies for scikit-learn.
Description
This environment defines the core runtime requirements for using scikit-learn. It is a CPU-based Python scientific computing stack. Scikit-learn requires Python >= 3.11 (supporting 3.11, 3.12, 3.13, and 3.14) and runs on Windows, POSIX, Unix, and macOS operating systems. The library is implemented as a mix of Python and Cython (compiled C extensions), requiring a proper build step for source installations. Pre-built wheels are available for common platforms.
Usage
Use this environment for any scikit-learn workflow, including supervised classification, data preprocessing, hyperparameter tuning, cross-validation, and ensemble model building. This is the mandatory baseline prerequisite for all scikit-learn implementations.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Windows, POSIX, Unix, macOS | All major platforms supported via CPython |
| Python | >= 3.11 | CPython only; 3.11, 3.12, 3.13, 3.14 are classified |
| Architecture | x86_64, aarch64, wasm32/64 | 32-bit and PowerPC marked non-deterministic for numerical tests |
| Build System | Meson + Cython | Required only for source builds, not pip install from wheel |
Dependencies
System Packages
- C compiler (gcc/clang/MSVC) — only for source builds
- OpenMP runtime library — for parallel computation in Cython extensions
Python Packages (Core Runtime)
- `numpy` >= 1.24.1
- `scipy` >= 1.10.0
- `joblib` >= 1.3.0
- `threadpoolctl` >= 3.2.0
Python Packages (Build)
- `cython` >= 3.1.2
- `meson-python` >= 0.17.1
- `numpy` >= 2 (build-time requirement, differs from runtime)
- `scipy` >= 1.10.0
Python Packages (Optional)
- `matplotlib` >= 3.6.1 — for plotting and visualization displays
- `pandas` >= 1.5.0 — for DataFrame support in data loading and output
- `polars` >= 0.20.30 — alternative DataFrame support
- `pyarrow` >= 12.0.0 — for Arrow-based data handling
- `scikit-image` >= 0.22.0 — for image processing examples
- `seaborn` >= 0.13.0 — for enhanced plotting
- `plotly` >= 5.18.0 — for interactive visualizations
Credentials
No credentials are required for core scikit-learn functionality. Network-dependent dataset loaders (e.g., `fetch_openml`) require internet access but no API tokens.
The following environment variables are available for configuration (not secrets):
- `SKLEARN_ASSUME_FINITE`: Skip NaN/Inf validation (default: False)
- `SKLEARN_WORKING_MEMORY`: Memory limit in MiB for chunked operations (default: 1024)
- `SKLEARN_SEED`: Set RNG seed for test reproducibility
Quick Install
# Core installation (from PyPI wheel)
pip install scikit-learn
# With common optional dependencies
pip install scikit-learn matplotlib pandas seaborn
# For development (source build)
pip install numpy scipy cython meson-python
pip install --no-build-isolation -e .
Code Evidence
Python version requirement from `pyproject.toml:15`:
requires-python = ">=3.11"
Core dependencies from `pyproject.toml:9-14`:
dependencies = [
"numpy>=1.24.1",
"scipy>=1.10.0",
"joblib>=1.3.0",
"threadpoolctl>=3.2.0",
]
Minimum dependency constants from `sklearn/_min_dependencies.py:10-15`:
NUMPY_MIN_VERSION = "1.24.1"
SCIPY_MIN_VERSION = "1.10.0"
JOBLIB_MIN_VERSION = "1.3.0"
THREADPOOLCTL_MIN_VERSION = "3.2.0"
PYTEST_MIN_VERSION = "7.1.2"
CYTHON_MIN_VERSION = "3.1.2"
Build verification from `sklearn/__check_build/__init__.py:51-54`:
try:
from sklearn.__check_build._check_build import check_build # noqa: F401
except ImportError as e:
raise_build_error(e)
Platform detection from `sklearn/utils/fixes.py:26-27`:
_IS_32BIT = 8 * struct.calcsize("P") == 32
_IS_WASM = platform.machine() in ["wasm32", "wasm64"]
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ImportError: It seems that scikit-learn has not been built correctly` | C extensions not compiled | Run `pip install --no-build-isolation -e .` for source installs |
| `ImportError: numpy>=1.24.1 is required` | NumPy version too old | `pip install --upgrade numpy>=1.24.1` |
| `ModuleNotFoundError: No module named 'sklearn'` | scikit-learn not installed | `pip install scikit-learn` |
| `{caller_name} requires matplotlib` | Optional dependency missing | `pip install matplotlib` |
| `{caller_name} requires pandas` | Optional dependency missing | `pip install pandas` |
Compatibility Notes
- 32-bit systems: Some numerical tests are marked non-deterministic on 32-bit platforms due to floating-point precision differences.
- PowerPC (ppc/powerpc): Tests marked non-deterministic due to numerical instability on these architectures.
- WebAssembly (wasm32/wasm64): Detected and handled via `_IS_WASM` flag; some features may have limited support.
- Windows: NumPy array representation differs; doctests may be skipped on Windows platforms.
- macOS: Requires `KMP_DUPLICATE_LIB_OK=True` environment variable (set automatically) to handle multiple OpenMP libraries.
Related Pages
- Implementation:Scikit_learn_Scikit_learn_Load_Iris
- Implementation:Scikit_learn_Scikit_learn_Train_Test_Split
- Implementation:Scikit_learn_Scikit_learn_LogisticRegression_Init
- Implementation:Scikit_learn_Scikit_learn_LogisticRegression_Fit
- Implementation:Scikit_learn_Scikit_learn_LinearClassifierMixin_Predict
- Implementation:Scikit_learn_Scikit_learn_Accuracy_Score
- Implementation:Scikit_learn_Scikit_learn_StandardScaler_Init
- Implementation:Scikit_learn_Scikit_learn_Make_Pipeline
- Implementation:Scikit_learn_Scikit_learn_Pipeline_Fit_Predict
- Implementation:Scikit_learn_Scikit_learn_GridSearchCV_Init
- Implementation:Scikit_learn_Scikit_learn_Cross_Validate
- Implementation:Scikit_learn_Scikit_learn_RandomForestClassifier_Init
- Implementation:Scikit_learn_Scikit_learn_GradientBoostingClassifier_Init
- Implementation:Scikit_learn_Scikit_learn_BaseForest_Fit
- Implementation:Scikit_learn_Scikit_learn_Permutation_Importance