Select to view content in your preferred language

Error when running Python script, no sklearn or scikit-learn

893
2
06-01-2020 09:16 AM
by Anonymous User
Not applicable

I am working on the Predicting Seagrass Tutorial and at the Python section, I keep getting the error that  no module exsists for sklearn and for scikit-learn (that I downloaded and replaced for sklearn after the first error).  Can someone help?  I can't find sklearn to download in the modules after cloning...here is the error.  I did replace sklearn with scikit-learn and tried different sytax as well.

from scikit-learn.ensemble import RandomForestClassifier
import numpy as NUM
import arcpy as ARCPY
import arcpy.da as DA
import pandas as PD
import seaborn as SEA
import matplotlib.pyplot as PLOT
import arcgisscripting as ARC
import SSUtilities as UTILS
import os as OS
File "<string>", line 1
from scikit-learn.ensemble import RandomForestClassifier

0 Kudos
2 Replies
RobertHeusser
New Contributor

You'll need to do a couple of things to get 

First, you will need to create a cloned environment: Work with Python environments—ArcGIS Pro | Documentation

Then, using this cloned environment you can go into the Python manager in ArcGIS Pro and add any of the listed packages like scikit-learn or scikit-learn.ensemble(or add ones that are not listed)

0 Kudos
KavianKoleini
Emerging Contributor

Hello,

@RobertHeusser I seem to be having the same issue identified in this older thread, failing to add the sklearn package to the active environment in ArcPro. I cloned the environment in ArcGIS Pro. Using the Package Manager, I do not see sklearn as an available package to add. How do I get the Package Manager in ArcGIS Pro to list sklearn as an additional package available for installation?

0 Kudos