Can't execute workflow example
Hi, I got below error by executing the example workflow in the readme. I am using python 3.8.18. Could you help with it?
(qlib) D:\Work\workspace\qlib\examples>qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
Traceback (most recent call last):
File "D:\Work\anaconda3\envs\qlib\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Work\anaconda3\envs\qlib\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "D:\Work\anaconda3\envs\qlib\Scripts\qrun.exe_main.py", line 7, in
yaml = YAML(typ='safe', pure=True) yaml.load(...)
instead of file "D:\Work\anaconda3\envs\qlib\lib\site-packages\qlib\workflow\cli.py", line 71
config = yaml.safe_load(fp)
change import ruamel.yaml as yaml to import yaml if you has PyYAML installed.
change
import ruamel.yaml as yamltoimport yamlif you hasPyYAMLinstalled.
changed to import yaml still not working
change
import ruamel.yaml as yamltoimport yamlif you hasPyYAMLinstalled.
Thanks for your answer, it has fixed the yaml issue. But the program is stuck with ModuleNotFoundError errors now:
(qlib) D:\Work\workspace\qlib\examples>qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml [32204:MainThread](2023-12-17 10:19:27,248) INFO - qlib.Initialization - [config.py:416] - default_conf: client. [32204:MainThread](2023-12-17 10:19:27,252) INFO - qlib.Initialization - [init.py:74] - qlib successfully initialized based on client settings. [32204:MainThread](2023-12-17 10:19:27,252) INFO - qlib.Initialization - [init.py:76] - data_path={'__DEFAULT_FREQ': WindowsPath('C:/Users/Summer/.qlib/qlib_data/cn_data')} [32204:MainThread](2023-12-17 10:19:27,263) WARNING - qlib.workflow - [expm.py:230] - No valid experiment found. Create a new experiment with name workflow. [32204:MainThread](2023-12-17 10:19:27,266) INFO - qlib.workflow - [exp.py:258] - Experiment 1 starts running ... [32204:MainThread](2023-12-17 10:19:27,670) INFO - qlib.workflow - [recorder.py:341] - Recorder 7500ac44c1d343fb9711fa530b57540c starts running under Experiment 1 ... ModuleNotFoundError. CatBoostModel are skipped. (optional: maybe installing CatBoostModel can fix it.) ModuleNotFoundError. XGBModel is skipped(optional: maybe installing xgboost can fix it). ModuleNotFoundError. PyTorch models are skipped (optional: maybe installing pytorch can fix it).
I think that lowering your ruamel.yaml version might solve the problem. Ref: https://github.com/microsoft/qlib/blob/main/setup.py#L77
change import ruamel.yaml as yaml to import yaml if you has PyYAML installed. and then change yaml.load to yaml.safe_load function
I think that lowering your ruamel.yaml version might solve the problem. Ref: https://github.com/microsoft/qlib/blob/main/setup.py#L77
I have downgraded it to 0.17.36 and changed import ruamel.yaml back, but I still got the same ModuleNotFoundError.
change
import ruamel.yaml as yamltoimport yamlif you hasPyYAMLinstalled.
Thanks a lot for your answer, it also helped with my problem.
change
import ruamel.yaml as yamltoimport yamlif you hasPyYAMLinstalled.
Thanks, it solves my problem.