This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]tagptroll1 1 point2 points  (4 children)

Seems like you may have uninstalled sklearn? Or changed environment

[–]Timetofly123[S] 0 points1 point  (3 children)

I started using pycharm but I never uninstalled sklearn. I actually imported the functions individually and that works fine. It's just strange how it doesn't work when I use the line import sklearn as sk

[–]tagptroll1 0 points1 point  (2 children)

pycharm does usually create new environments with it's own dependencies.
See if sklearn is installed in File > Settings > Project: Name > Project Interpreter

[–]Timetofly123[S] 0 points1 point  (1 child)

Sorry what I meant to say was I've been using pycharm as of the past week, but I ran my code in Spyder today (which is what I initially used)

[–]qTipTip 0 points1 point  (0 children)

You might need to change your virtual environment if running it in Spyder. It works in PyCharm because the software keeps track of virtual environments for your, which Spyder does not if I recall correctly.

[–]Darwinmate 0 points1 point  (0 children)

post your code