qlib icon indicating copy to clipboard operation
qlib copied to clipboard

Can't execute workflow example

Open summer980824 opened this issue 2 years ago • 8 comments

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 File "D:\Work\anaconda3\envs\qlib\lib\site-packages\qlib\workflow\cli.py", line 115, in run fire.Fire(workflow) File "D:\Work\anaconda3\envs\qlib\lib\site-packages\fire\core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "D:\Work\anaconda3\envs\qlib\lib\site-packages\fire\core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "D:\Work\anaconda3\envs\qlib\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "D:\Work\anaconda3\envs\qlib\lib\site-packages\qlib\workflow\cli.py", line 71, in workflow config = yaml.safe_load(fp) File "D:\Work\anaconda3\envs\qlib\lib\site-packages\ruamel\yaml\main.py", line 1105, in safe_load error_deprecation('safe_load', 'load', arg="typ='safe', pure=True") File "D:\Work\anaconda3\envs\qlib\lib\site-packages\ruamel\yaml\main.py", line 1037, in error_deprecation raise AttributeError(s) AttributeError: "safe_load()" has been removed, use

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)

summer980824 avatar Dec 02 '23 04:12 summer980824

change import ruamel.yaml as yaml to import yaml if you has PyYAML installed.

lonsdale8734 avatar Dec 07 '23 08:12 lonsdale8734

change import ruamel.yaml as yaml to import yaml if you has PyYAML installed.

changed to import yaml still not working

Jasonchang6435 avatar Dec 16 '23 11:12 Jasonchang6435

change import ruamel.yaml as yaml to import yaml if you has PyYAML installed.

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).

summer980824 avatar Dec 17 '23 02:12 summer980824

I think that lowering your ruamel.yaml version might solve the problem. Ref: https://github.com/microsoft/qlib/blob/main/setup.py#L77

SunsetWolf avatar Dec 22 '23 05:12 SunsetWolf

change import ruamel.yaml as yaml to import yaml if you has PyYAML installed. and then change yaml.load to yaml.safe_load function

Jasonchang6435 avatar Dec 24 '23 12:12 Jasonchang6435

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.

summer980824 avatar Dec 26 '23 00:12 summer980824

change import ruamel.yaml as yaml to import yaml if you has PyYAML installed.

Thanks a lot for your answer, it also helped with my problem.

Vapour1005 avatar Jan 03 '24 08:01 Vapour1005

change import ruamel.yaml as yaml to import yaml if you has PyYAML installed.

Thanks, it solves my problem.

l0ngc avatar Feb 12 '24 17:02 l0ngc