{"id":1054,"hash":"c33081e408b4731db0e04b51eb2caad5bf2fc8eb809d3eef036fbd0795827b01","pattern":"Eliminating warnings from scikit-learn","full_message":"I would like to ignore warnings from all packages when I am teaching, but scikit-learn seems to work around the use of the warnings package to control this. For example:\n\nwith warnings.catch_warnings():\n    warnings.simplefilter(\"ignore\")\n    from sklearn import preprocessing\n\n/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:66: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead\n  if 'order' in inspect.getargspec(np.copy)[0]:\n/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:358: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead\n  if 'exist_ok' in inspect.getargspec(os.makedirs).args:\n\nAm I using this module incorrectly, or is sklearn doing something its not supposed to?","ecosystem":"pypi","package_name":"scikit-learn","package_version":null,"solution":"It annoys me to the extreme that sklearn forces warnings.\n\nI started using this at the top of main.py:\n\ndef warn(*args, **kwargs):\n    pass\nimport warnings\nwarnings.warn = warn\n\n#... import sklearn stuff...","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn","votes":80,"created_at":"2026-04-19T04:52:13.806833+00:00","updated_at":"2026-04-19T04:52:13.806833+00:00"}