Sagemaker 笔记本上的 xgboost 导入失败 [英] xgboost on Sagemaker notebook import fails
问题描述
我正在尝试在 Sagemaker 笔记本上使用 XGBoost.
I am trying to use XGBoost on Sagemaker notebook.
我正在使用 conda_python3
内核,并且安装了以下软件包:
I am using conda_python3
kernel, and the following packages are installed:
- py-xgboost-mutex
- libxgboost
- py-xgboost
- py-xgboost-gpu
但是一旦我尝试导入 xgboost,它就会在导入时失败:
But once I am trying to import xgboost it fails on import:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-5-5943d1bfe3f1> in <module>()
----> 1 import xgboost as xgb
ModuleNotFoundError: No module named 'xgboost'
推荐答案
在 Sagemaker notebooks 中使用以下步骤
In Sagemaker notebooks use the below steps
i) !type python3
ii) 假设上面是/home/ec2-user/anaconda3/envs/python3/bin/python3
ii) Say the above is /home/ec2-user/anaconda3/envs/python3/bin/python3 for you
iii) !/home/ec2-user/anaconda3/envs/python3/bin/python3 -m pip install xgboost
iv) import xgboost
i) conda 激活 conda_python3
ii) pip install xgboost
免责声明:有时安装会因 gcc 版本而失败,在这种情况下,请在运行安装之前更新 pip 版本
Disclaimer : sometimes the installation would fail with gcc version ,in that case update pip version before running install
这篇关于Sagemaker 笔记本上的 xgboost 导入失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!