"qlib/data/_libs/rolling" can not be import
❓ Questions and Help
We sincerely suggest you to carefully read the documentation of our library as well as the official paper. After that, if you still feel puzzled, please describe the question clearly under this issue.
location in : qlib/data/_libs/ expanding, rolling can't import beacause of ".pyx" file.
- we can create "setup.py" in the same directory of rolling.pyx and expanding.pyx
- in this directory, run command: python setup.py build _ext --inplace
############## #用于转换pyx文件# ##############
#命令行运行:python setup.py build_ext --inplace
from setuptools import setup, Extension from Cython.Build import cythonize import numpy
#定义扩展模块 extensions = [ Extension( "expanding", # 模块名 ["expanding.pyx"], # 源文件 include_dirs=[numpy.get_include()], # 添加 NumPy 头文件路径 extra_compile_args=["-O3"], # 编译参数 extra_link_args=["-Wl,-rpath,/usr/local/lib"], # 链接参数 language="c++", # 使用 C++ 编译器 ), Extension( "rolling", # 模块名 ["rolling.pyx"], # 源文件 include_dirs=[numpy.get_include()], # 添加 NumPy 头文件路径 extra_compile_args=["-O3"], # 编译参数 extra_link_args=["-Wl,-rpath,/usr/local/lib"], # 链接参数 language="c++", # 使用 C++ 编译器 ), ]
#配置 setup setup( ext_modules=cythonize( extensions, compiler_directives={"language_level": "3"} # Python 3 语法 ), )
Hi, @Peakara
I saw your issue and tried to reproduce your problem, I created a new python 3.10 virtual environment, pulled the latest code, built it using python setup.py build_ext --inplace and tried to run examples/benchmarks/LightGBM/ workflow_config_lightgbm_Alpha158.yaml and everything seems to work fine, providing more information to help us reproduce the problem.
Also, we have recently made some upgrades from setup.py to pyproject.toml and created a Makefile, you can try pull the latest code and installing it using make install or make dev.