Closed matheus695p closed 1 year ago
I have added the following lines into settings.py
. They seem to work.
import warnings
warnings.simplefilter("ignore", category=DeprecationWarning)
@lamhm, I had already tried it, but it doesn't work with kedro versions higher than 0.18
I have just tried this out on Kedro 0.18.4 and can confirm that @lamhm's solution works and is the one I'd recommend. If it's not working for you then there must be something else in your setup that's causing the problem (e.g. some plugin, library or code in your project interfering somehow). Getting logging to work as you wish in Python is notoriously fiddly and temperamental I'm afraid.
Here's another option if the above doesn't work. It's more aggressive than the above solution because they will silence not just DeprecationWarning
s but any warnings raised by warnings.warn
(logging.warnings
will still get through though, which is probably what you want). Add the following lines to settings.py:
import logging
logging.getLogger("py.warnings").setLevel(logging.ERROR)
Hi @matheus695p, did the comment above resolve the issue, or will this need further investigation?
I'll close this issue for now. If you @matheus695p, or anyone else still faces problems with logging at the kedro project level, feel free to re-open! 🙂
I'm seeing a number of warnings of the type below but I can't seem to figure out how to stop kedro from logging these to std console
thought the snippet below might work if I add it to the cli.py but it didnt' do the job.. What do I seem to be missing here?
/envs/kedro_test/lib/python3.7/site-packages/sklearn/linear_model/_least_angle.py:34: DeprecationWarning:
np.floatis a deprecated alias for the builtin
float. To silence this warning, use
floatby itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use
np.float64here.
Do you have suggestions where to place these warning filters, in versions later than 0.18 it is not possible to disable external warnings as proposed in this issue https://github.com/kedro-org/kedro/issues/737