Python Forum

Full Version: Using SK Learn Library with Spyder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All

I am new to Spyder / Python and trying to use the SK Learn Library with Spyder on Windows 10 however i get an Module not found error.

I installed Python latest version first and then SK Learn using PIP which seems to be fine. I then installed Spyder which seems to have installed another version of Python under the Spyder directory. I have tried to link Spyder to the installed SK Learn library using the PythonPath manager but still the library is not recognized.

Should i be able to use the library where it is or do i need to install it in the Spyder directory ? I have tried to install it in Spyder using PIP from the Spyder console but calling !PIP does not work so not sure how i would install it there ?

Any help greatly appreciated

J
It sounds like you are running into environment problems. Spyder is likely running in an environment that does not include your sklearn library.

Are you using Anaconda? venv?

What is probably your easiest solution is installing Spyder with Anaconda, then use Anaconda to create an environment for your project (this is good form, not required). Then using cmd as an administrator you pip install sklearn. Add it to your new environment (if you created one) and you are set.
(Jun-02-2021, 02:18 PM)jefsummers Wrote: [ -> ]It sounds like you are running into environment problems. Spyder is likely running in an environment that does not include your sklearn library.

Are you using Anaconda? venv?

What is probably your easiest solution is installing Spyder with Anaconda, then use Anaconda to create an environment for your project (this is good form, not required). Then using cmd as an administrator you pip install sklearn. Add it to your new environment (if you created one) and you are set.

Thanks for your reply - I used the Spyder install package recommended for Windows 10 so no i have not used Anaconda. Is there a solution without using Anaconda dya think ?
You need to point your Spyder app to the environment where you have sklearn installed.

Or, try this. In Spyder, type the following into the command area (or do it as a program and run it). The exclamation point is important:
!pip install -U scikit-learn
See if that solves it.