You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在AWS深度学习AMI上安装scikit-learn遇ModuleNotFoundError问题求助

Fixing ModuleNotFoundError for scikit-learn in AWS Deep Learning AMI

It looks like the issue comes down to installing scikit-learn in the wrong Conda environment—you installed it somewhere that doesn’t match the environment your Jupyter Notebook is running from. Let’s walk through fixing this:

Step 1: Check your Conda environments and scikit-learn’s location

First, list all your Conda environments to see which one you’re using and where scikit-learn might be installed:

conda env list

You’ll see a list of environments (like base, python3, or AWS-specific ones) with an * next to the currently active one.

Next, verify if scikit-learn is installed in the python3 environment you activated:

conda list -n python3 scikit-learn

If scikit-learn doesn’t show up here, that’s the problem—you probably installed it into the base environment instead, but Jupyter is running from python3.

Step 2: Install scikit-learn in the correct environment

Activate the python3 environment first, then install scikit-learn directly into it:

# For older Conda versions
source activate python3
# For Conda 4.4+
conda activate python3

# Install scikit-learn into the active python3 environment
conda install -c anaconda scikit-learn

Step 3: Restart Jupyter and test

Close your existing Jupyter Notebook session, restart it with jupyter notebook, and re-run your import code. The ModuleNotFoundError should disappear once scikit-learn is available in the environment Jupyter is using.

Alternative: Use the base environment (if you prefer)

If you’d rather stick with the base environment where scikit-learn is already installed:

  1. Activate the base environment:
    source activate base  # or conda activate base
    
  2. Make sure Jupyter is installed in base:
    conda install jupyter
    
  3. Launch Jupyter from the base environment, and select the base kernel when creating a new notebook.

内容的提问来源于stack exchange,提问作者Garglesoap

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 04:27:53