qlib: ModuleNotFoundError: No module named 'qlib.config'

Both on Windows and Linux, when I run the command: python run_all_model.py --models=lightgbm, I got the following error message:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'qlib.config'

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 22 (1 by maintainers)

Most upvoted comments

If I run the file: workflow_by_code.py on windows 10, I got the following error message:

Do not import qlib package in the repository directory!
python-BaseException
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\doc\code_python\dl_framework\qlib\qlib\contrib\model\gbdt.py", line 8, in <module>
    from ...model.base import ModelFT
  File "C:\doc\code_python\dl_framework\qlib\qlib\model\__init__.py", line 6, in <module>
    from .base import Model
  File "C:\doc\code_python\dl_framework\qlib\qlib\model\base.py", line 5, in <module>
    from ..data.dataset import Dataset
  File "C:\doc\code_python\dl_framework\qlib\qlib\data\__init__.py", line 8, in <module>
    from .data import (
  File "C:\doc\code_python\dl_framework\qlib\qlib\data\data.py", line 21, in <module>
    from .cache import H
  File "C:\doc\code_python\dl_framework\qlib\qlib\data\cache.py", line 35, in <module>
    from .ops import *
  File "C:\doc\code_python\dl_framework\qlib\qlib\data\ops.py", line 18, in <module>
    from ._libs.rolling import rolling_slope, rolling_rsquare, rolling_resi
ModuleNotFoundError: No module named 'qlib.data._libs.rolling'

Hi @ardeal , if you want to run the workflow with qrun with a different data path, it is recommended to change the provider_uri in the yaml file such as workflow_config_lightgbm_Alpha158.yaml manully for now.

Another option would be running the workflow with workflow_by_code.py under the examples folder, where the provider_uri should be modified accordingly as well.

We are sorry that Qlib is not supporting multi-platform in a decent way. We will try to make it more convenient for users to run models directly on different OS in the near future.

Thanks.