mljar / mljar-supervised

Python package for AutoML on Tabular Data with Feature Engineering, Hyper-Parameters Tuning, Explanations and Automatic Documentation
https://mljar.com
MIT License
3k stars 401 forks source link

XgboostError #134

Closed peter-WeiZhang closed 4 years ago

peter-WeiZhang commented 4 years ago

XGBoostError: [14:36:23] C:\Users\Administrator\workspace\xgboost-win64_release_1.0.0\dmlc-core\src\io\local_filesys.cc:209: Check failed: allow_null: LocalFileSystem::Open "C:\Users\ZW\AppData\Local\Temp\tmp_mu9qwkg": Permission denied

I don't know how to solve this, I have tried to open jupyter notebook with root, but still not work, thanks!

peter-WeiZhang commented 4 years ago

XGBoostError Traceback (most recent call last)

in 1 automl = AutoML() # total train limit = 1 hour ----> 2 automl.fit(X_train, y_train) d:\anaconda3\envs\mljar\lib\site-packages\supervised\automl.py in fit(self, X_train, y_train, X_validation, y_validation) 1122 1123 except Exception as e: -> 1124 raise e 1125 finally: 1126 if self._X_train_path is not None: d:\anaconda3\envs\mljar\lib\site-packages\supervised\automl.py in fit(self, X_train, y_train, X_validation, y_validation) 1052 self._time_start[self._fit_level] = start 1053 for params in tuner.default_params(len(self._models)): -> 1054 self.train_model(params) 1055 self._time_spend["default_algorithms"] = np.round(time.time() - start, 2) 1056 d:\anaconda3\envs\mljar\lib\site-packages\supervised\automl.py in train_model(self, params) 553 raise AutoMLException(f"Cannot create directory {model_path}") 554 --> 555 mf.train(model_path) 556 557 mf.save(model_path) d:\anaconda3\envs\mljar\lib\site-packages\supervised\model_framework.py in train(self, model_path) 142 self.callbacks.on_iteration_start() 143 --> 144 learner.fit(X_train, y_train, X_validation, y_validation, log_to_file) 145 146 self.callbacks.on_iteration_end( d:\anaconda3\envs\mljar\lib\site-packages\supervised\algorithms\xgboost.py in fit(self, X, y, X_validation, y_validation, log_to_file) 111 # https://github.com/dmlc/xgboost/issues/5474 112 with tempfile.NamedTemporaryFile() as tmp: --> 113 self.model.save_model(tmp.name) 114 del self.model 115 self.model = xgb.Booster() d:\anaconda3\envs\mljar\lib\site-packages\xgboost\core.py in save_model(self, fname) 1495 if isinstance(fname, (STRING_TYPES, os_PathLike)): # assume file name 1496 _check_call(_LIB.XGBoosterSaveModel( -> 1497 self.handle, c_str(os_fspath(fname)))) 1498 else: 1499 raise TypeError("fname must be a string or os_PathLike") d:\anaconda3\envs\mljar\lib\site-packages\xgboost\core.py in _check_call(ret) 187 """ 188 if ret != 0: --> 189 raise XGBoostError(py_str(_LIB.XGBGetLastError())) 190 191 XGBoostError: [14:36:23] C:\Users\Administrator\workspace\xgboost-win64_release_1.0.0\dmlc-core\src\io\local_filesys.cc:209: Check failed: allow_null: LocalFileSystem::Open "C:\Users\ZW\AppData\Local\Temp\tmp_mu9qwkg": Permission denied
pplonski commented 4 years ago

When training xgboost Im saving it to temporary file and reloading to reduce RAM consumption. Maybe there is smarter way to reduce the RAM?

The error means that your operating system doesnt allow to create temporary file because of permissions. Have you try to run it as a script?

peter-WeiZhang commented 4 years ago

When training xgboost Im saving it to temporary file and reloading to reduce RAM consumption. Maybe there is smarter way to reduce the RAM?

The error means that your operating system doesnt allow to create temporary file because of permissions. Have you try to run it as a script?

I have tried to download as python script in jupyter and ran it with VS Code, it reports the same error.

pplonski commented 4 years ago

Thank you for checking! I will fix this with #127 issue.

pplonski commented 4 years ago

Fixed in release 0.6.1. Closing the issue.