0

我正在尝试为量化投资项目安装 Microsoft qlib。

The initial installation worked fine. Finding stock info and converting it to from csv to qlib format. However, the initialization process goes wrong.

I run the following Python script from qlib doc:

    import qlib
    from qlib.constant import REG_CN
    provider_uri = "~/.qlib/qlib_data/cn_data"  # target_dir
    qlib.init(provider_uri=provider_uri, region=REG_CN)

**But I got the following warning**:

**#### Do not import qlib package in the repository directory in case of importing qlib from . without compiling #####**

and further more:

     19 try:
---> 20     from ._libs.rolling import rolling_slope, rolling_rsquare, rolling_resi
     21     from ._libs.expanding import expanding_slope, expanding_rsquare, expanding_resi
     22 except ImportError:

ModuleNotFoundError: No module named 'qlib.data._libs.rolling'

However files are there, inside the directory:

~\qlib\qlib\data\_libs

rolling.cpp rolling.pyx
expanding.cpp expanding.pyx

This is my configuration

Windows
AMD64
Windows-10-10.0.19043-SP0
10.0.19043

Python version: 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)]

Qlib version: 0.8.3
numpy==1.21.2
pandas==1.3.5
scipy==1.7.3
requests==2.27.1
sacred==0.8.2
python-socketio==5.5.1
redis==4.1.1
python-redis-lock==3.7.0
schedule==1.1.0
cvxpy==1.1.18
hyperopt==0.1.2
fire==0.4.0
statsmodels==0.13.0
xlrd==2.0.1
plotly==5.1.0
matplotlib==3.5.0
tables==3.6.1
pyyaml==6.0
mlflow==1.23.0
tqdm==4.62.3
loguru==0.5.3
lightgbm==3.3.2
tornado==6.1
joblib==1.1.0
fire==0.4.0
ruamel.yaml==0.17.20

此外,有人可以向我解释以下句子:

不要在qlib的repository目录下导入qlib包,否则可能会出错。

谢谢你的帮助。我不知道继续并使其工作。

4

0 回答 0