ArdalanM/pyLightGBM

pyLightGBM is looking for LIGHTGBM_EXEC environment Variable

Opened this issue · 1 comments

Hello,

I have been trying to run the code of pylightgbm but it raises the exception that

" pyLightGBM is looking for 'LIGHTGBM_EXEC' environment variable, cannot be found.
exec_path will be deprecated in favor of environment variable "

I have also tried specifying the path to the lightgbm package installed in the library as well as pointed the path towards the lightgbm or pylightgbm package files which were downloaded from their respective github sources, but none of the files seem to provide the 'LIGHTGBM_EXEC' file/folder.

That is why i think the exception is getting raised again and again, ?? Is there a workaround this Issue.

Also, please see that I have tried using the following link which i think could probably provide a work around, but the last two lines while using conda prompt are NOT clear. That is, pip install requirements points to which source, they are certainly not present in pep8 package that was downloaded. Why are we using setup.py at the end ?? What package does this try install considering pip was already used to install packages

https://github.com/ArdalanM/pyLightGBM/blob/master/.travis.yml

  • conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
    • source activate test-environment
    • pip install pytest pytest-cov python-coveralls pytest-xdist coverage #we need this version of coverage for coveralls.io to work
    • pip install pep8 pytest-pep8
      _- pip install -r requirements.txt
    • python setup.py install_

Any suggestion, feedback is welcome

Update: Earlier I had forgot to mention the .exe with ~LightGBM/lightgbm as it was recommended in the documents page, but even after fixing that now, additional errors seem to have appeared as well. Note that I am using Windows 10

exec_path='C:\Users\hp\LightGBM\lightgbm.exe'

and Here is the full list of error information

Initialization
-----------------------------------------------------------------------------------------------------------
 Step |   Time |      Value |   bagging_fraction |   feature_fraction |   min_data_in_leaf |   num_leaves | 
pyLightGBM is looking for 'LIGHTGBM_EXEC' environment variable, cannot be found.
exec_path will be deprecated in favor of environment variable
pyLightGBM is looking for 'LIGHTGBM_EXEC' environment variable, cannot be found.
exec_path will be deprecated in favor of environment variable
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-36-4c00f17520bd> in <module>()
     11                              )
     12 
---> 13 gbmrBO.maximize(init_points=init_points, n_iter=num_iter)
     14 
     15 print('Final Results')

C:\Anaconda3\lib\site-packages\bayes_opt\bayesian_optimization.py in maximize(self, init_points, n_iter, acq, kappa, xi, **gp_params)
    247             if self.verbose:
    248                 self.plog.print_header()
--> 249             self.init(init_points)
    250 
    251         y_max = self.Y.max()

C:\Anaconda3\lib\site-packages\bayes_opt\bayesian_optimization.py in init(self, init_points)
    102         for x in self.init_points:
    103 
--> 104             y_init.append(self.f(**dict(zip(self.keys, x))))
    105 
    106             if self.verbose:

<ipython-input-35-89b948a81f4e> in gbmr_eval(num_leaves, min_data_in_leaf, feature_fraction, bagging_fraction, seed)
     29     )
     30 
---> 31     score =  cross_val_score(gbmr, X=X, y=y, scoring=make_scorer(score_func=mae, greater_is_better=False), cv=5, verbose=0, pre_dispatch=1)
     32     return np.array(score).mean()

C:\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in cross_val_score(estimator, X, y, groups, scoring, cv, n_jobs, verbose, fit_params, pre_dispatch)
    138                                               train, test, verbose, None,
    139                                               fit_params)
--> 140                       for train, test in cv_iter)
    141     return np.array(scores)[:, 0]
    142 

C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self, iterable)
    756             # was dispatched. In particular this covers the edge
    757             # case of Parallel used with an exhausted iterator.
--> 758             while self.dispatch_one_batch(iterator):
    759                 self._iterating = True
    760             else:

C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in dispatch_one_batch(self, iterator)
    606                 return False
    607             else:
--> 608                 self._dispatch(tasks)
    609                 return True
    610 

C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in _dispatch(self, batch)
    569         dispatch_timestamp = time.time()
    570         cb = BatchCompletionCallBack(dispatch_timestamp, len(batch), self)
--> 571         job = self._backend.apply_async(batch, callback=cb)
    572         self._jobs.append(job)
    573 

C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\_parallel_backends.py in apply_async(self, func, callback)
    107     def apply_async(self, func, callback=None):
    108         """Schedule a func to be run"""
--> 109         result = ImmediateResult(func)
    110         if callback:
    111             callback(result)

C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\_parallel_backends.py in __init__(self, batch)
    324         # Don't delay the application, to avoid keeping the input
    325         # arguments in memory
--> 326         self.results = batch()
    327 
    328     def get(self):

C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self)
    129 
    130     def __call__(self):
--> 131         return [func(*args, **kwargs) for func, args, kwargs in self.items]
    132 
    133     def __len__(self):

C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in <listcomp>(.0)
    129 
    130     def __call__(self):
--> 131         return [func(*args, **kwargs) for func, args, kwargs in self.items]
    132 
    133     def __len__(self):

C:\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, error_score)
    236             estimator.fit(X_train, **fit_params)
    237         else:
--> 238             estimator.fit(X_train, y_train, **fit_params)
    239 
    240     except Exception as e:

C:\Anaconda3\lib\site-packages\pylightgbm\models.py in fit(self, X, y, test_data, init_scores)
    141         process.wait()
    142 
--> 143         with open(self.param['output_model'], mode='r') as file:
    144             self.model = file.read()
    145         shutil.rmtree(tmp_dir)

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\hp\\AppData\\Local\\Temp\\tmp5g151j0c\\LightGBM_model.txt'