qlib icon indicating copy to clipboard operation
qlib copied to clipboard

Error with installing pyqlib from source using "pip install ."

Open VenerableDeity opened this issue 11 months ago • 3 comments

I use the Windows system and have installed Python 3.8.19. I encountered a problem while installing pyqlib. How can I resolve this?

Building wheels for collected packages: pyqlib Building wheel for pyqlib (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pyqlib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [202 lines of output] running bdist_wheel running build running build_py running egg_info writing pyqlib.egg-info\PKG-INFO writing dependency_links to pyqlib.egg-info\dependency_links.txt writing entry points to pyqlib.egg-info\entry_points.txt writing requirements to pyqlib.egg-info\requires.txt writing top-level names to pyqlib.egg-info\top_level.txt reading manifest file 'pyqlib.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'qlib\VERSION.txt' adding license file 'LICENSE' writing manifest file 'pyqlib.egg-info\SOURCES.txt' running build_ext Compiling qlib/data/libs/rolling.pyx because it depends on C:\Users\xing\AppData\Local\Temp\pip-build-env-4muktctc\overlay\Lib\site-packages\Cython\Includes\libcpp\deque.pxd. [1/1] Cythonizing qlib/data/_libs/rolling.pyx building 'qlib.data.libs.rolling' extension "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\xing\AppData\Local\Temp\pip-build-env-4muktctc\overlay\Lib\site-packages\numpy\core\include -ID:\Program_Files\anaconda3\envs\qlib\include -ID:\Program_Files\anaconda3\envs\qlib\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\VS\include" "-ID:\Windows Kits\10\include\10.0.22000.0\ucrt" "-ID:\Windows Kits\10\include\10.0.22000.0\um" "-ID:\Windows Kits\10\include\10.0.22000.0\shared" "-ID:\Windows Kits\10\include\10.0.22000.0\winrt" "-ID:\Windows Kits\10\include\10.0.22000.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-ID:\Windows Kits\10\include\10.0.22000.0\ucrt" "-ID:\Windows Kits\10\include\10.0.22000.0\shared" "-ID:\Windows Kits\10\include\10.0.22000.0\um" "-ID:\Windows Kits\10\include\10.0.22000.0\winrt" "-ID:\Windows Kits\10\include\10.0.22000.0\cppwinrt" /EHsc /Tpqlib/data/_libs/rolling.cpp /Fobuild\temp.win32-cpython-38\Release\qlib/data/libs/rolling.obj rolling.cpp C:\Users\xing\AppData\Local\Temp\pip-build-env-4muktctc\overlay\Lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\Program_Files\anaconda3\envs\qlib\libs /LIBPATH:D:\Program_Files\anaconda3\envs\qlib /LIBPATH:D:\Program_Files\anaconda3\envs\qlib\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\ATLMFC\lib\x86" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:D:\Windows Kits\10\lib\10.0.22000.0\ucrt\x86" "/LIBPATH:D:\Windows Kits\10\lib\10.0.22000.0\um\x86" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\ATLMFC\lib\x86" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:D:\Windows Kits\10\lib\10.0.22000.0\ucrt\x86" "/LIBPATH:D:\Windows Kits\10\lib\10.0.22000.0\um\x86" /EXPORT:PyInit_rolling build\temp.win32-cpython-38\Release\qlib/data/_libs/rolling.obj /OUT:build\lib.win32-cpython-38\qlib\data_libs\rolling.cp38-win_amd64.pyd /IMPLIB:build\temp.win32-cpython-38\Release\qlib/data/_libs\rolling.cp38-win_amd64.lib 正在创建库 build\temp.win32-cpython-38\Release\qlib/data/_libs\rolling.cp38-win_amd64.lib 和对象 build\temp.win32-cpython-38\Release\qlib/data/_libs\rolling.cp38-win_amd64.exp rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyBaseObject_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyDict_NewPresized rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_SetAttr rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_InternFromString rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyCFunction_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyOS_snprintf rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyThreadState_Get rolling.obj : error LNK2001: 无法解析的外部符号 __imp___Py_CheckRecursionLimit rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_SetObject rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyCode_NewEmpty rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_GivenExceptionMatches rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_AsUnsignedLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_WarnEx rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_RuntimeWarning rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyFrame_New rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_DeprecationWarning rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyImport_ImportModule rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyLong_AsByteArray rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyImport_ImportModuleLevelObject rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_Occurred rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_FromSsize_t rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GenericGetAttr rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyTraceBack_Here rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyThreadState_UncheckedGet rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_RuntimeError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyMethod_New rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_IOError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_SetAttrString rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_FromLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GC_UnTrack rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_Hash rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_MemoryError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyInterpreterState_GetID rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_FromUnsignedLongLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp__Py_GetVersion rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GetAttr rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyFloat_AsDouble rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_AsUnsignedLongLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp___Py_NoneStruct rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_AsLongLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyTuple_New rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_SetItemString rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_Size rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_FromLongLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_AttributeError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyTuple_GetSlice rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_SetString rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_WarnFormat rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_ValueError rolling.obj : error LNK2001: 无法解析的外部符号 __imp___Py_CheckRecursiveCall rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_FromUnsignedLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_Next rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_Format rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_ArithmeticError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_RichCompare rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyTuple_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp___Py_FalseStruct rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyImport_GetModule rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyFloat_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyLong_FromByteArray rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyModule_NewObject rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyMethod_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_Restore rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_Join rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_OverflowError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyCode_NewWithPosOnlyArgs rolling.obj : error LNK2001: 无法解析的外部符号 __imp___Py_Dealloc rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyTuple_GetItem rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyImport_GetModuleDict rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyModule_GetDict rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PySequence_GetSlice rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_Free rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_ExceptionMatches rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyCapsule_GetPointer rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GC_Del rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_Fetch rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyLong_AsLong rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_ClearWeakRefs rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_Not rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_AsUTF8 rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_FromFormat rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GetBuffer rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyList_New rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyImport_AddModule rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyType_Ready rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GetAttrString rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_Clear rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_RichCompareBool rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_Decode rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyCapsule_New rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyObject_GenericGetAttrWithDict rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_SetItem rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_New rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_CallFinalizerFromDealloc rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyDict_GetItem_KnownHash rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyMem_Free rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyList_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_NoMemory rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_GetItemString rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GetItem rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_CallObject rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyModuleDef_Init rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_GC_Track rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyBytes_FromStringAndSize rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyImport_Import rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_DelItem rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_Compare rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_IsSubclass rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_TypeError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyMem_Realloc rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyCapsule_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_IsTrue rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_NameError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyTuple_Pack rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyUnicode_Ready rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyMem_Malloc rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_IndexError rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_ImportError rolling.obj : error LNK2001: 无法解析的外部符号 __imp___Py_TrueStruct rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_SystemError rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyObject_GC_New rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyException_SetCause rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyType_Modified rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyTraceBack_Type rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_FromString rolling.obj : error LNK2001: 无法解析的外部符号 __imp___PyType_Lookup rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_Size rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyBuffer_Release rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_Call rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyUnicode_FromStringAndSize rolling.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_ModuleNotFoundError rolling.obj : error LNK2001: 无法解析的外部符号 _imp___PyObject_GetDictPtr build\lib.win32-cpython-38\qlib\data_libs\rolling.cp38-win_amd64.pyd : fatal error LNK1120: 134 个无法解析的外部命令 C:\Users\xing\AppData\Local\Temp\pip-build-env-4muktctc\overlay\Lib\site-packages\setuptools\command\build_py.py:207: _Warning: Package 'qlib.data._libs' is absent from the packages configuration. !!

          ********************************************************************************
          ############################
          # Package would be ignored #
          ############################
          Python recognizes 'qlib.data._libs' as an importable package[^1],
          but it is absent from setuptools' `packages` configuration.

          This leads to an ambiguous overall configuration. If you want to distribute this
          package, please make sure that 'qlib.data._libs' is explicitly added
          to the `packages` configuration field.

          Alternatively, you can also rely on setuptools' discovery methods
          (for example by using `find_namespace_packages(...)`/`find_namespace:`
          instead of `find_packages(...)`/`find:`).

          You can read more about "package discovery" on setuptools documentation page:

          - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

          If you don't want 'qlib.data._libs' to be distributed and are
          already explicitly excluding 'qlib.data._libs' via
          `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
          you can try to use `exclude_package_data`, or `include-package-data=False` in
          combination with a more fine grained `package-data` configuration.

          You can read more about "package data files" on setuptools documentation page:

          - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


          [^1]: For Python, any directory (with suitable naming) can be imported,
                even if it does not contain any `.py` files.
                On the other hand, currently there is no concept of package data
                directory, all directories are treated like packages.
          ********************************************************************************

  !!
    check.warn(importable)
  C:\Users\xing_\AppData\Local\Temp\pip-build-env-4muktctc\overlay\Lib\site-packages\Cython\Compiler\Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: E:\Study\Python\qlib-main\qlib\data\_libs\rolling.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x86\\link.exe' failed with exit code 1120
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyqlib Failed to build pyqlib ERROR: Could not build wheels for pyqlib, which is required to install pyproject.toml-based projects

VenerableDeity avatar Mar 25 '24 14:03 VenerableDeity

I have resolved the above issue by reinstalling Microsoft Build Tools.

VenerableDeity avatar Mar 26 '24 01:03 VenerableDeity

Hi, I have reinstalled Microsoft Build Tools and pip install pyproject, but it is still wrong with this error. Is there any method that can solve it?

lbycan avatar Apr 30 '24 08:04 lbycan

Hi, I have reinstalled Microsoft Build Tools and pip install pyproject, but it is still wrong with this error. Is there any method that can solve it?

After reinstalling Microsoft Build Tools, I successfully resolved all issues by following the instructions in this link: https://www.bilibili.com/video/BV1ZC4y1Q7AU/?spm_id_from=333.337.search-card.all.click&vd_source=b51775505f30dd0bff940e24b47eae29. Essentially, the required versions for the following libraries - numpy==1.23.5, cython==3.0.2, pandas==1.5.3 - must be satisfied, after which the Qlib can run smoothly.

VenerableDeity avatar May 02 '24 03:05 VenerableDeity