QLIB的安装踩坑-畏途巉岩不可攀

(写在前面)
使用conda环境来安装,win10
(询问了某相关人,他表示最好使用Linux安装,可能坑少)
conda在这种动不动装错了要回退的地方简直救我狗命
如果有什么相关询问的可以评论,如果我遇到的我会尽力解答

安装Qlib里面遇到的问题

不能安装numpy最新版,这个似乎是老毛病了,我之前装啥的时候遇到过一次,卸载numpy并且安装大概就是降级到numpy1.19.3就可以了,可以继续往下跑了
在报错信息里面可以找到numpy相关的字样

  1. 主要是这些问题
cythoning qlib/data/_libs/rolling.pyx to qlib/data/_libs\rolling.cpp
C:\Users\10208\.conda\envs\Wretches\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\P2\202012\ProjectWretches\qlib-main\qlib-main\qlib\data\_libs\rolling.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
cythoning qlib/data/_libs/expanding.pyx to qlib/data/_libs\expanding.cpp
C:\Users\10208\.conda\envs\Wretches\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\P2\202012\ProjectWretches\qlib-main\qlib-main\qlib\data\_libs\expanding.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
building 'qlib.data._libs.rolling' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

其实我机子的VS已经差不多好久没装过了,那么就装一个VS吧,谁让他不带运行库呢。

有个人给出了一种解决方法,不知道靠不靠谱

  1. 不报错了,但是在这里卡好久
    Downloading https://files.pythonhosted.org/packages/d6/f1/07ebaf7fc989dddfd933b37acd22a9fca4fd3aaa2e793c395b7c56955270/mlflow-1.13-py3-none-any.whl#sha256=2db66f3605357b7d8cfe7cedb5d952e178c680e760cd02adf6201dfb86982ffd
    
    也就是这里
Installed c:\users\10208\.conda\envs\wretches\lib\site-packages\loguru-0.5.3-py3.8.egg
Searching for tqdm
Reading https://pypi.org/simple/tqdm/
Downloading https://files.pythonhosted.org/packages/05/bb/9403e1f30ed060e16835c9b275620ca89191a41ccc2b995b88efbc32dfd9/tqdm-4.55.0-py2.py3-none-any.whl#sha256=0cd81710de29754bf17b6fee07bdb86f956b4fa20d3078f02040f83e64309416
Best match: tqdm 4.55.0
Processing tqdm-4.55.0-py2.py3-none-any.whl
Installing tqdm-4.55.0-py2.py3-none-any.whl to c:\users\10208\.conda\envs\wretches\lib\site-packages
Adding tqdm 4.55.0 to easy-install.pth file
Installing tqdm-script.py script to C:\Users\10208\.conda\envs\Wretches\Scripts
Installing tqdm.exe script to C:\Users\10208\.conda\envs\Wretches\Scripts

Installed c:\users\10208\.conda\envs\wretches\lib\site-packages\tqdm-4.55.0-py3.8.egg
Searching for mlflow>=1.12.1
Reading https://pypi.org/simple/mlflow/
Downloading https://files.pythonhosted.org/packages/d6/f1/07ebaf7fc989dddfd933b37acd22a9fca4fd3aaa2e793c395b7c56955270/mlflow-1.13-py3-none-any.whl#sha256=2db66f3605357b7d8cfe7cedb5d952e178c680e760cd02adf6201dfb86982ffd

mlflow下不下来呗,我的conda配置了豆瓣的镜像,那我手动PIP install就好了

这个mfflow安装好了,他应该是试图安装qlib了,我也不知道为啥,给我提示这些

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pyqlib 0.6.1.dev0 requires cvxpy==1.0.21, which is not installed.
pyqlib 0.6.1.dev0 requires fire>=0.3.1, which is not installed.
pyqlib 0.6.1.dev0 requires hyperopt==0.1.1, which is not installed.
pyqlib 0.6.1.dev0 requires matplotlib==3.1.3, which is not installed.
pyqlib 0.6.1.dev0 requires plotly==4.12.0, which is not installed.
pyqlib 0.6.1.dev0 requires pymongo==3.7.2, which is not installed.
pyqlib 0.6.1.dev0 requires python-redis-lock>=3.3.1, which is not installed.
pyqlib 0.6.1.dev0 requires python-socketio==3.1.2, which is not installed.
pyqlib 0.6.1.dev0 requires redis>=3.0.1, which is not installed.
pyqlib 0.6.1.dev0 requires sacred>=0.7.4, which is not installed.
pyqlib 0.6.1.dev0 requires schedule>=0.6.0, which is not installed.
pyqlib 0.6.1.dev0 requires scipy>=1.0.0, which is not installed.
pyqlib 0.6.1.dev0 requires statsmodels, which is not installed.
pyqlib 0.6.1.dev0 requires tables>=3.6.1, which is not installed.
pyqlib 0.6.1.dev0 requires xlrd>=1.0.0, which is not installed.

那么就一个一个安装?我TEMIAO?

装第一个的时候就出了点问题,谁知道之后怎么样

我TEMIAO?

 ERROR: Command errored out with exit status 1:
     command: 'C:\Users\10208\.conda\envs\Wretches\python.exe' 'C:\Users\10208\.conda\envs\Wretches\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\10208\AppData\Local\Temp\tmp68ha1tni'
         cwd: C:\Users\10208\AppData\Local\Temp\pip-install-psdsowgs\cvxpy_83ec0c616d2542b18164e5019a86113c
    Complete output (55 lines):
    running dist_info
    creating C:\Users\10208\AppData\Local\Temp\pip-modern-metadata-vclr2t76\cvxpy.egg-info
    writing C:\Users\10208\AppData\Local\Temp\pip-modern-metadata-vclr2t76\cvxpy.egg-info\PKG-INFO
    writing dependency_links to C:\Users\10208\AppData\Local\Temp\pip-modern-metadata-vclr2t76\cvxpy.egg-info\dependency_links.txt
    writing requirements to C:\Users\10208\AppData\Local\Temp\pip-modern-metadata-vclr2t76\cvxpy.egg-info\requires.txt
    writing top-level names to C:\Users\10208\AppData\Local\Temp\pip-modern-metadata-vclr2t76\cvxpy.egg-info\top_level.txt
    writing manifest file 'C:\Users\10208\AppData\Local\Temp\pip-modern-metadata-vclr2t76\cvxpy.egg-info\SOURCES.txt'
    Traceback (most recent call last):
      File "C:\Users\10208\.conda\envs\Wretches\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
        main()
      File "C:\Users\10208\.conda\envs\Wretches\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "C:\Users\10208\.conda\envs\Wretches\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\build_meta.py", line 161, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\build_meta.py", line 253, in run_setup
        super(_BuildMetaLegacyBackend,
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 57, in <module>
        setup(
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\10208\.conda\envs\Wretches\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\10208\.conda\envs\Wretches\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\10208\.conda\envs\Wretches\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\command\dist_info.py", line 31, in run
        egg_info.run()
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 298, in run
        self.find_sources()
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 305, in find_sources
        mm.run()
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 536, in run
        self.add_defaults()
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 572, in add_defaults
        sdist.add_defaults(self)
      File "C:\Users\10208\.conda\envs\Wretches\lib\distutils\command\sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "C:\Users\10208\.conda\envs\Wretches\lib\distutils\command\sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "C:\Users\10208\.conda\envs\Wretches\lib\distutils\cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "C:\Users\10208\.conda\envs\Wretches\lib\distutils\cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "setup.py", line 23, in finalize_options
        import numpy
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\numpy\__init__.py", line 305, in <module>
        _win_os_check()
      File "C:\Users\10208\AppData\Local\Temp\pip-build-env-fsocp06l\overlay\Lib\site-packages\numpy\__init__.py", line 302, in _win_os_check
        raise RuntimeError(msg.format(__file__)) from None
    RuntimeError: The current Numpy installation ('C:\\Users\\10208\\AppData\\Local\\Temp\\pip-build-env-fsocp06l\\overlay\\Lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\10208\.conda\envs\Wretches\python.exe' 'C:\Users\10208\.conda\envs\Wretches\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\10208\AppData\Local\Temp\tmp68ha1tni' Check the logs for full command output.

matplotlib还需要正好这个版本可还行,我一个一个装不是办法啊

Searching for matplotlib==3.1.3

那么直接PIP装非最新版怎么样呢?

是个办法,但是还是安装CVXPY是一个非常致命的问题,报告同样错误

Collecting cvxpy==1.0.21
  Downloading https://pypi.doubanio.com/packages/82/d5/0b787694c85297e36d3afd4c8574973809a7cc52aa2c602413012da8999d/cvxpy-1.0.21.tar.gz (917 kB)
     |████████████████████████████████| 917 kB 1.3 MB/s
 ** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD  parameter number  2 had an illegal value
 ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\10208\.conda\envs\Wretches_1\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\10208\\AppData\\Local\\Temp\\pip-install-d92acsk_\\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\\setup.py'"'"'; __file__='"'"'C:\\Users\\10208\\AppData\\Local\\Temp\\pip-install-d92acsk_\\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\10208\AppData\Local\Temp\pip-pip-egg-info-8rdp47dx'
         cwd: C:\Users\10208\AppData\Local\Temp\pip-install-d92acsk_\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\
    Complete output (42 lines):
    running egg_info
    creating C:\Users\10208\AppData\Local\Temp\pip-pip-egg-info-8rdp47dx\cvxpy.egg-info
    writing C:\Users\10208\AppData\Local\Temp\pip-pip-egg-info-8rdp47dx\cvxpy.egg-info\PKG-INFO
    writing dependency_links to C:\Users\10208\AppData\Local\Temp\pip-pip-egg-info-8rdp47dx\cvxpy.egg-info\dependency_links.txt
    writing requirements to C:\Users\10208\AppData\Local\Temp\pip-pip-egg-info-8rdp47dx\cvxpy.egg-info\requires.txt
    writing top-level names to C:\Users\10208\AppData\Local\Temp\pip-pip-egg-info-8rdp47dx\cvxpy.egg-info\top_level.txt
    writing manifest file 'C:\Users\10208\AppData\Local\Temp\pip-pip-egg-info-8rdp47dx\cvxpy.egg-info\SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\10208\AppData\Local\Temp\pip-install-d92acsk_\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\setup.py", line 56, in <module>
        setup(
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\site-packages\setuptools\command\egg_info.py", line 298, in run
        self.find_sources()
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\site-packages\setuptools\command\egg_info.py", line 305, in find_sources
        mm.run()
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\site-packages\setuptools\command\egg_info.py", line 536, in run
        self.add_defaults()
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\site-packages\setuptools\command\egg_info.py", line 572, in add_defaults
        sdist.add_defaults(self)
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\distutils\command\sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\distutils\command\sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\distutils\cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "C:\Users\10208\.conda\envs\Wretches_1\lib\distutils\cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "C:\Users\10208\AppData\Local\Temp\pip-install-d92acsk_\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\setup.py", line 23, in finalize_options
        import numpy
      File "c:\users\10208\appdata\local\temp\pip-install-d92acsk_\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\.eggs\numpy-1.19.4-py3.8-win-amd64.egg\numpy\__init__.py", line 305, in <module>
        _win_os_check()
      File "c:\users\10208\appdata\local\temp\pip-install-d92acsk_\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\.eggs\numpy-1.19.4-py3.8-win-amd64.egg\numpy\__init__.py", line 302, in _win_os_check
        raise RuntimeError(msg.format(__file__)) from None
    RuntimeError: The current Numpy installation ('c:\\users\\10208\\appdata\\local\\temp\\pip-install-d92acsk_\\cvxpy_bb03ccaa1e214377a84b9f44fc1b41d1\\.eggs\\numpy-1.19.4-py3.8-win-amd64.egg\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

那么这里是CVX的问题,采取以下链接的办法
https://blog.csdn.net/Teddy_of_mm/article/details/105184531

解决了吗?没有的,安装完之后报错依旧

有人提示使用PIP3?可以吗?

结果仍然是报错依旧。

有人提示使用管理员权限来安装,还是报错依旧

这个error code相关的错误通常是,安装的系统架构版本不太一样,或者版本不太一样之类的

通常不是安装程序内部出了问题

看到这个老哥表示https://blog.csdn.net/wf_he/article/details/108505852

cvxpy目前仅支持3.7.2以下的版本

我火速

conda create -n wr2 python=3.7.2

pip install cvxpy,结果秒成功,

然后先pip install pyqlib

其实,他把我含辛茹苦安装的cvxpy给卸载了,估计是要重新安装,在这里卡了很久,不知道会不会成功

问了一下某大牛,大牛让我换源,推荐在Linux下面安装之类的,但是也表示不应该有这么多报错

至少pip程序是跑下来了,只有一行黄色的warning是关于pip版本太低的

(对,如果你们遇到问题可以考虑装个高一点的python

到此,“稳定版”安装完成

至于开发板的话,使用setup.py运行的那个嘛,因为setup里面指定的下载源太慢了,我觉得只要改善一下众所周知的网络原因就好了

那么开始hello world

首先下载数据,需要cd到项目目录,保证你当前运行命令的地方可以看到scripts

(wr2) PS D:\P2\202012\ProjectWretches\qlib-main\qlib-main> python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn

看一下数据

WARN: data not found for SH600004.vwap
WARN: data not found for SH600010.vwap
WARN: data not found for SH600009.vwap
WARN: data not found for SH600011.vwap
WARN: data not found for SH600015.vwap
WARN: data not found for SH600000.vwap
WARN: data not found for SH600016.vwap
WARN: data not found for SH600018.vwap
WARN: data not found for SH600019.vwap
WARN: data not found for SH600025.vwap
WARN: data not found for SH600027.vwap
WARN: data not found for SH600028.vwap
WARN: data not found for SH600029.vwap
WARN: data not found for SH600031.vwap
WARN: data not found for SH600030.vwap
WARN: data not found for SH600036.vwap
WARN: data not found for SH600038.vwap
WARN: data not found for SH600048.vwap
WARN: data not found for SH600050.vwap
WARN: data not found for SH600061.vwap
WARN: data not found for SH600066.vwap
WARN: data not found for SH600068.vwap
WARN: data not found for SH600085.vwap
WARN: data not found for SH600089.vwap
WARN: data not found for SH600104.vwap
WARN: data not found for SH600109.vwap
WARN: data not found for SH600111.vwap
WARN: data not found for SH600115.vwap
WARN: data not found for SH600118.vwap
WARN: data not found for SH600170.vwap
WARN: data not found for SH600176.vwap
WARN: data not found for SH600177.vwap
WARN: data not found for SH600183.vwap
WARN: data not found for SH600188.vwap
WARN: data not found for SH600196.vwap

算了,还是import好了就行了吧,其他的不担心了

posted @ 2020-12-31 11:51  Amazonite  阅读(4405)  评论(2编辑  收藏  举报