ray-project / tune-sklearn

A drop-in replacement for Scikit-Learn’s GridSearchCV / RandomizedSearchCV -- but with cutting edge hyperparameter tuning techniques.
https://docs.ray.io/en/master/tune/api_docs/sklearn.html
Apache License 2.0
467 stars 51 forks source link

FileNotFoundError on Windows #210

Closed kjans123 closed 3 years ago

kjans123 commented 3 years ago

Script:

from tune_sklearn import TuneSearchCV
import logging
ray_logger = logging.getLogger("ray")
ray_logger.setLevel("CRITICAL")

model = LGBMRegressor(random_state=r)
param_dists = {
    "n_estimators": list(range(10,501)),
    "max_depth": list(range(50, 501)),
    "num_leaves": list(range(30, 501)),
   "learning_rate": list(np.linspace(0.01, 0.9, 100)),
   "min_child_samples": list(range(50, 501)),
   "boosting_type": ['gbdt', 'dart']

}
gs = TuneSearchCV(model, param_dists, n_trials=5, max_iters=10,
                  search_optimization='random')
gs.fit(X_train, y_train)

Trace:

runcell(2, 'E:/kjans/Anaconda/coordinates/3D project/Dim3Contour - Copy.py')
Traceback (most recent call last):

  File "E:\kjans\Anaconda\coordinates\3D project\Dim3Contour - Copy.py", line 1535, in <module>
    gs.fit(X_train, y_train)

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\tune_sklearn\tune_basesearch.py", line 663, in fit
    ray.init(

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\_private\client_mode_hook.py", line 62, in wrapper
    return func(*args, **kwargs)

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\worker.py", line 793, in init
    _global_node = ray.node.Node(

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\node.py", line 230, in __init__
    self.start_head_processes()

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\node.py", line 861, in start_head_processes
    self.start_redis()

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\node.py", line 678, in start_redis
    self.get_resource_spec(),

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\node.py", line 339, in get_resource_spec
    self._resource_spec = ResourceSpec(

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\resource_spec.py", line 149, in resolve
    num_gpus = _autodetect_num_gpus()

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\ray\resource_spec.py", line 241, in _autodetect_num_gpus
    lines = subprocess.check_output(cmdargs).splitlines()[1:]

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in __init__
    super(SubprocessPopen, self).__init__(*args, **kwargs)

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File "C:\Users\KyleJanson\.conda\envs\sp4\lib\subprocess.py", line 1311, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

FileNotFoundError: [WinError 2] The system cannot find the file specified

Running this with Spyder in a miniconda environment on Windows. I'm not sure what file is not being found?

kjans123 commented 3 years ago

Ran the code on my WSL2 (Windows Subsystem for Linux) . Ran fine. Started a new conda environment on Windows. Got the same error.

richardliaw commented 3 years ago

Hmmm, it seems like somehow subprocess doesn't work in Spyder?

kjans123 commented 3 years ago

Hmmm, it seems like somehow subprocess doesn't work in Spyder?

I'm not sure? That could be the case, but not savvy enough to troubleshoot that.