Skip to content

Commit

Permalink
Merge pull request deepchem#506 from lilleswing/lazy-import
Browse files Browse the repository at this point in the history
Lazy Import xgboost
  • Loading branch information
rbharath authored Apr 6, 2017
2 parents 8a35de2 + 904b278 commit 5ed5afa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deepchem/models/xgboost_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Scikit-learn wrapper interface of xgboost
"""

import xgboost as xgb
from deepchem.utils.dependencies import xgboost as xgb
import numpy as np
import os
from deepchem.models import Model
Expand Down
11 changes: 11 additions & 0 deletions deepchem/utils/dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
This file is for lazily importing optional dependencies
"""
try:
import xgboost as xgboost
except:
print("Warning: No XGBOOST installed on your system")
print(
"Attempting to run models with XGBOOST dependencies will throw runtime errors"
)
xgboost = None

0 comments on commit 5ed5afa

Please sign in to comment.