30

Whenever I try to use "sklearn" in PyCharm, I get the following error on the console.

DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp

I am not sure if it should bother me, because program still working, but it's annoying. How can I get rid of it?

I made every change, people recommended in linked question but the error is still there.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Ekrem Solmaz
  • 637
  • 1
  • 10
  • 22
  • 1
    See this: https://docs.python.org/3/library/imp.html and this: https://docs.python.org/3/library/importlib.html#module-importlib – OrderAndChaos Oct 01 '18 at 17:45
  • This is not an error but a warning. You even write yourself "DeprecationWarning". Any warning can be ignored. – MERose Dec 13 '18 at 12:22
  • 1
    @MERose but it outputs a message and shows to the user and messes up the screen making it difficult to ignore – mmmmmm Dec 19 '18 at 18:31
  • 4
    And when one see a huge warning sign e.g. red sign ahead, it is not always clever to ignore – Ofer Rahat Feb 08 '19 at 06:38
  • Is there any way to make this disappear? I tried to suppress the warning through the python3 warning module but no luck. – gohongyi Mar 30 '19 at 03:31
  • This is NOT a duplicate. It is also NOT a Python or sklearn issue, but purely a PyCharm issue. See https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000058690-Module-not-found-in-PyCharm-but-externally-in-Python which is a thread started before this question was posted and was added to as recently as April of 2020. There were many suggestions made but no clear solution presented. – Malik A. Rumi Dec 12 '20 at 17:56

1 Answers1

-11

I deleted the code that imports "imp", from "cloudpickle.py" and the warning is gone but I hope I didn't mess up anything. You can also simply ignore this, since it's not an error.

Edit: I don't want to remove the question or answer because people still visit this page but this is not a solution and it is a bad way to handle it, just ignore this warning. I did this in my very amateur days, sorry :(

Ekrem Solmaz
  • 637
  • 1
  • 10
  • 22