首页 > 解决方案 > ModuleNotFoundError:没有名为“snorkel.labeling”的模块

问题描述

我使用 conda 安装了 snorkel,当我尝试运行时 - from snorkel.labeling import labeling_function它会引发以下错误 - ModuleNotFoundError: No module named 'snorkel.labeling'

我尝试在 Github 上寻找解决方案,但不幸的是,我无法坚持到底。我还尝试安装nb_conda_kernels, 以使您的所有 conda 环境在 jupyter 中可用,但没有帮助。还尝试创建一个单独的环境,安装 snorkel 并从 snorkel 的环境中启动 jupyter notebook,但它也不起作用。非常感谢任何形式的帮助!

提前致谢!

标签: pythonjupytersnorkel

解决方案


试试这些安装说明

conda create --yes -n snorkel
conda activate snorkel
conda install pytorch==1.1.0 -c pytorch
conda install snorkel==0.9.0 -c conda-forge

或者这些,在这里列出

# [OPTIONAL] Activate a virtual environment
conda create --yes -n spam python=3.6
conda activate spam

# Install requirements (both shared and tutorial-specific)
pip install environment_kernels
# We specify PyTorch here to ensure compatibility, but it may not be necessary.
conda install pytorch==1.1.0 -c pytorch
conda install snorkel==0.9.5 -c conda-forge
pip install -r spam/requirements.txt

# Launch the Jupyter notebook interface
jupyter notebook spam

推荐阅读