首页 > 解决方案 > 为什么 jupyter notebook 包在 aws sagemaker notebook 实例中不起作用?

问题描述

fig, axes = plt.subplots(2,figsize=(15,10))
sns.lineplot(agg_cases_death.index, agg_cases_death.cases, ax=axes[0]).set_title('Cases')
sns.lineplot(agg_cases_death.index, agg_cases_death.deaths, ax=axes[1]).set_title('Deaths')
plt.show()

以上曾经在我桌面上的 jupyter notebook 上完美运行,但是当我在 AWS Sagemaker Jupyter notebook 中运行相同的代码时,它会产生错误。它说模块“seaborn”没有属性线图。

在使用 aws sagemaker jupyter 时我们需要设置什么吗?

标签: pythonamazon-web-servicesjupyter-notebookamazon-sagemaker

解决方案


众所周知,AWS Sagemaker 对此一窍不通。

尝试一下sns.__version__,您会发现您正在运行旧的 seaborn 版本。

您可以通过以下方式解决此问题:

del sns

!conda update seaborn --yes

import seaborn as sns
sns.__version__

在单独的单元格中。

Seaborn 是 sagemaker 实例上默认 conda 设置的一部分,因此您不能使用 pip install 来修复版本问题。


推荐阅读