ModuleNotFoundError: No module named 'sklearn'

Ads
 

ModuleNotFoundError: No module named 'sklearn'

Hi,

I am trying to use sklearn with Python machine learning program. My program gives following error:

python 1.py
Traceback (most recent call last):
  File "1.py", line 2, in <module>
    from sklearn.datasets import fetch_20newsgroups
ModuleNotFoundError: No module named 'sklearn'

How to install sklearn?

Thanks

View Answers

January 19, 2019 at 8:07 AM

Hi,

The sklearn is powerful machine learning library in Python. It provides a wide range of supervised and unsupervised learning algorithms.

You can install it with pip with following command:

pip install sklearn

Here is full sklearn installation process:

(tf12) [email protected]:~/textgeneration$ pip install sklearn
Collecting sklearn
  Downloading https://files.pythonhosted.org/packages/1e/7a/dbb3be0ce9bd5c8b7e3d87328e79063f8b263b2b1bfa4774cb1147bfcd3f/sklearn-0.0.tar.gz
Collecting scikit-learn (from sklearn)
  Downloading https://files.pythonhosted.org/packages/0d/3a/b92670f5c368c20329ecc4c255993fae7934564d485c3ed7ea7b8da7f741/scikit_learn-0.20.2-cp36-cp36m-manylinux1_x86_64.whl (5.4MB)
    100% 5.4MB 780kB/s 
Requirement already satisfied: numpy>=1.8.2 in /home/deepak/anaconda3/envs/tf12/lib/python3.6/site-packages (from scikit-learn->sklearn) (1.16.0)
Collecting scipy>=0.13.3 (from scikit-learn->sklearn)
  Downloading https://files.pythonhosted.org/packages/67/e6/6d4edaceee6a110ecf6f318482f5229792f143e468b34a631f5a0899f56d/scipy-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (26.6MB)
    100% | 26.6MB 591kB/s 
Building wheels for collected packages: sklearn
  Running setup.py bdist_wheel for sklearn ... done
  Stored in directory: /home/deepak/.cache/pip/wheels/76/03/bb/589d421d27431bcd2c6da284d5f2286c8e3b2ea3cf1594c074
Successfully built sklearn
Installing collected packages: scipy, scikit-learn, sklearn
Successfully installed scikit-learn-0.20.2 scipy-1.2.0 sklearn-0.0

Thanks

Ads









Related Tutorials/Questions & Answers:
ImportError: No module named scipy.ndimage - Solved
ImportError: No module named scipy.ndimage - Solved  Hi, How to solve following error: ImportError: No module named scipy.ndimage This error..., in <module> import scipy.ndimage as ndi ImportError: No module named
Hibernate named queries
Hibernate named queries  Hi, What is named queries in Hibernate? Thanks
Advertisements
a class named Transactions
a class named Transactions  Write this java code for me: a class named Transactions that holds the memo and the amount of a transaction. Prompt the user for the number of transactions and create a new Transaction object
Design a class named account
Design a class named account  The class contains: § An int data field named id for the account (default 0). § A double data field named balance for the account (default 0.0) § A double data field named annualInterestRate
Database named studentinfo
Database named studentinfo  1.create design of studentinfo using swing component 2.Create a database named student info. 3.create a table that stores all the details from the form,application of basic Normalization is required
Database named studentinfo
Database named studentinfo  1.create design of studentinfo using swing component 2.Create a database named student info. 3.create a table that stores all the details from the form,application of basic Normalization is required
Database named studentinfo
Database named studentinfo  1.create design of studentinfo using swing component 2.Create a database named student info. 3.create a table that stores all the details from the form,application of basic Normalization is required
Named ? SQL query in hibernate
Named ? SQL query in hibernate  What is Named SQL query in hibernate?   You can put all the HQL into the XML mapping file rather than putting the sql queries to various places in between code. sample.hbm.xml <
Hibernate Named Query
This section contain description of named query with example
create named class - Java Beginners
create named class  Can you check my [email protected]: How to create a class named Employee with name and salary. Make a class Manager inherit from Employee with an instance field named department. Supply a method toString
Hibernate Named Native SQL Query
In this section, you will learn Named Native SQL Query in Hibernate
JPA setParameter (Named Parameter)
JPA setParameter (Named Parameter)   ... API's method setParameter as a named parameter. JPA Query API's supports two types of setParameter.  1. Named Parameters  2. Numbered Parameters
Hibernate Named HQL in Annotation
In this section, you will learn how to execute Named HQL written in Model class Annotation
Admin Module
Admin Module The admin have the privilege  to add the question, delete the question. He is responsible for maintaining the site. He can also search the question paper by question Id and by title. The Admin does the following
Version of com.fmpwizard>lift-named-comet_2.8.1 dependency
List of Version of com.fmpwizard>lift-named-comet_2.8.1 dependency
Version of com.fmpwizard>lift-named-comet_2.8.2 dependency
List of Version of com.fmpwizard>lift-named-comet_2.8.2 dependency
Version of com.fmpwizard>lift-named-comet_2.9.0-1 dependency
List of Version of com.fmpwizard>lift-named-comet_2.9.0-1 dependency
Version of com.fmpwizard>lift-named-comet_2.9.1 dependency
List of Version of com.fmpwizard>lift-named-comet_2.9.1 dependency
User Module
User Module The user first need to make registration on the website for appearing in the online examination. After the making successful registration he is eligible for online test examination. To appear in the examination he need
spring JEE module tutorial
spring JEE module tutorial  Hi, I want spring Jee module tutorial and spring ORM module tutorial plz send me
named parameters vs postional parameters - Hibernate
named parameters vs postional parameters  hi,Can you please explain why we i should go for particular parameters or positional parameter... regards, somasekhar
Hibernate Named HQL using XML Mapping
In this section, you will learn executing Named HQL written in XML Mapping file
JPA Named Parameter List
JPA Named Parameter List   ... application using JPA Named Parameter List. This is similar as named parameter but here we use the an array list as named parameter.  Named Parameter List
JPA Named Parameter
JPA Named Parameter       In this section, you will learn how to use JPA Named Parameter in your jpa application. In JPA named parameter is used where you assign names
Hibernate Named Native SQL in Annotation
In this section, you will learn how to execute the Named Native SQL written in Model class Annotation
JPA Named Queries
JPA Named Queries       In this section, you will know about the JPA Named Queries...;) }) For developing JPA Named Queries, you need the following files
spring DAO module turorial
spring DAO module turorial  how to integrate springDAO and spring webMVC
exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined
exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined  Hi, In my web... is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined
Write a program named InternetCharge_YourLastName that do the following:
Write a program named InternetCharge_YourLastName that do the following: ... per month unlimited access is provided. Write a program named InternetCharge.... Instruction: We should have two classes class named InternetService
Hibernate Named Query
Hibernate Named Query       Named Query is very useful concept in hibernate. It lets...;   Calling Named Query in the coding section You can call
Maven Dependency lift-named-comet_2.8.1 >> 0.3
You should include the dependency code given in this page to add Maven Dependency of com.fmpwizard >> lift-named-comet_2.8.1 version0.3 in your project

Ads