{"id":8623,"library":"scikit-misc","title":"scikit-misc","description":"scikit-misc is a Python library providing a collection of miscellaneous tools for data analysis and scientific computing. It includes algorithms that were once part of SciPy's `scipy.misc` module but were removed or deemed unstable, now offered in a more robust form. The library is currently at version 0.5.2 and maintains an active development and release cadence, requiring Python >=3.10.","status":"active","version":"0.5.2","language":"en","source_language":"en","source_url":"https://github.com/has2k1/scikit-misc","tags":["scientific computing","data analysis","loess","smoothing","scipy-replacement"],"install":[{"cmd":"pip install scikit-misc","lang":"bash","label":"Recommended via pip"},{"cmd":"conda install conda-forge::scikit-misc","lang":"bash","label":"Recommended via Conda"}],"dependencies":[{"reason":"Fundamental for numerical operations; often a build dependency.","package":"numpy","optional":false},{"reason":"Often used alongside SciPy; contains algorithms complementary to SciPy's core.","package":"scipy","optional":false}],"imports":[{"symbol":"loess","correct":"from skmisc.loess import loess"}],"quickstart":{"code":"import numpy as np\nfrom skmisc.loess import loess\n\n# Generate some sample data\nx = np.linspace(0, 10, 100)\ny = np.sin(x) + np.random.normal(0, 0.5, 100)\n\n# Fit a LOESS model\nmodel = loess(x, y)\nmodel.fit()\n\n# Get smoothed predictions and statistics\npred = model.predict(x).values\n\nprint(f\"First 5 original y values: {y[:5]}\")\nprint(f\"First 5 smoothed y values: {pred[:5]}\")","lang":"python","description":"This example demonstrates how to use the `loess` function from `skmisc.loess` to perform locally-weighted regression on a sample dataset, generating smoothed predictions."},"warnings":[{"fix":"Ensure `pip install scikit-misc` or `conda install conda-forge::scikit-misc` is run within the *correct* active Python environment. If using Jupyter, ensure the kernel points to this environment. Sometimes, reinstalling with `--user` or explicitly managing `PYTHONPATH` might be necessary.","message":"Users often encounter 'ModuleNotFoundError' even after installation, particularly in complex environments like Anaconda or when using different Python interpreters.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update imports to `from skmisc.some_module import function` or use alternative functions within modern SciPy modules.","message":"Older SciPy users might recall algorithms (e.g., `scipy.misc.face`, `scipy.misc.ascent`) that were deprecated or removed from `scipy.misc`. `scikit-misc` aims to re-introduce some of these or similar functionalities, but direct `scipy.misc` imports will no longer work and require migrating to `scikit-misc` or other SciPy submodules.","severity":"breaking","affected_versions":"Prior to scikit-misc's existence / SciPy versions that removed `scipy.misc`"},{"fix":"Use official pre-built wheels (`pip install scikit-misc`) whenever possible. For build failures, ensure `numpy` is installed as a build dependency, and check the GitHub issues for specific patches or workarounds related to your Python/Numpy version. Recent commits have addressed Python >= 3.12 and Numpy 2.0 compatibility.","message":"Building `scikit-misc` from source, especially on less common platforms or with pre-release Python versions (e.g., Python 3.13, or sometimes on Windows), can lead to compilation errors due to dependencies on Fortran/C/Cython code and build system interactions with `numpy`.","severity":"gotcha","affected_versions":"All versions (especially when building from source or with new Python/Numpy versions)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install scikit-misc` or `conda install conda-forge::scikit-misc` in your active environment. Verify the environment is correctly activated.","cause":"The `scikit-misc` package is either not installed or not installed in the Python environment currently in use.","error":"ModuleNotFoundError: No module named 'scikit-misc'"},{"fix":"Confirm `scikit-misc` is installed in the *same* Python environment where the calling library is installed and being executed. Reinstalling `scikit-misc` with `pip install --user scikit-misc --force` or ensuring the correct `PYTHONPATH` can sometimes resolve this.","cause":"This error typically occurs when another library (e.g., `plotnine` or `scanpy`) tries to use `skmisc.loess` but cannot find the installed `scikit-misc` package in the execution environment.","error":"For loess smoothing, install 'scikit-misc'"},{"fix":"This issue has been addressed in recent `scikit-misc` commits. Ensure you are using the latest version of `scikit-misc`. If building from source, ensure `numpy` is correctly installed in your build environment. Prefer installing pre-built wheels if available.","cause":"This is a build-time error, often related to `meson-python` failing to find `numpy` headers during compilation, particularly with newer Python versions (e.g., 3.13) where build dependencies might not be automatically linked.","error":"ERROR: Command `/usr/bin/python3 -c 'import os os.chdir(os.path.join(\"..\", \"tools\")) import numpy as np try: incdir = os.path.relpath(np.get_include()) except Exception: incdir = np.get_include() print(incdir) '` failed with status 1."}]}