diff --git a/.github/workflows/test_qlib_from_pip.yml b/.github/workflows/test_qlib_from_pip.yml index 4efe10dc42..6af5747266 100644 --- a/.github/workflows/test_qlib_from_pip.yml +++ b/.github/workflows/test_qlib_from_pip.yml @@ -31,10 +31,16 @@ jobs: - name: Update pip to the latest version run: | python -m pip install --upgrade pip + + # Will cancel this step when the next qlib version is released. The current qlib version is: 0.9.6 + - name: Installing pywinpt for windows + if: ${{ matrix.os == 'windows-latest' }} + run: | + python -m pip install pywinpty --only-binary=:all: - name: Qlib installation test run: | - python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pyqlib==0.9.5.80 + python -m pip install pyqlib - name: Install Lightgbm for MacOS if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }} diff --git a/Makefile b/Makefile index 03dfc7310c..6e13aa1364 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,12 @@ PUBLIC_DIR := $(shell [ "$$READTHEDOCS" = "True" ] && echo "$$READTHEDOCS_OUTPUT SO_DIR := qlib/data/_libs SO_FILES := $(wildcard $(SO_DIR)/*.so) +ifeq ($(OS),Windows_NT) + IS_WINDOWS = true +else + IS_WINDOWS = false +endif + ######################################################################################## # Development Environment Management ######################################################################################## @@ -48,6 +54,10 @@ deepclean: clean # What this code does is compile two Cython modules, rolling and expanding, using setuptools and Cython, # and builds them as binary expansion modules that can be imported directly into Python. # Since pyproject.toml can't do that, we compile it here. + +# pywinpty as a dependency of jupyter on windows, if you use pip install pywinpty installation, +# will first download the tar.gz file, and then locally compiled and installed, +# this will lead to some unnecessary trouble, so we choose to install the compiled whl file, to avoid trouble. prerequisite: @if [ -n "$(SO_FILES)" ]; then \ echo "Shared library files exist, skipping build."; \ @@ -58,6 +68,10 @@ prerequisite: python -c "from setuptools import setup, Extension; from Cython.Build import cythonize; import numpy; extensions = [Extension('qlib.data._libs.rolling', ['qlib/data/_libs/rolling.pyx'], language='c++', include_dirs=[numpy.get_include()]), Extension('qlib.data._libs.expanding', ['qlib/data/_libs/expanding.pyx'], language='c++', include_dirs=[numpy.get_include()])]; setup(ext_modules=cythonize(extensions, language_level='3'), script_args=['build_ext', '--inplace'])"; \ fi + @if [ "$(IS_WINDOWS)" = "true" ]; then \ + python -m pip install pywinpty --only-binary=:all:; \ + fi + # Install the package in editable mode. dependencies: python -m pip install -e . @@ -87,7 +101,7 @@ analysis: python -m pip install -e .[analysis] all: - python -m pip install -e .[dev,lint,docs,package,test,analysis,rl] + python -m pip install -e .[pywinpty,dev,lint,docs,package,test,analysis,rl] install: prerequisite dependencies diff --git a/README.md b/README.md index 1621800963..afc17b33c2 100644 --- a/README.md +++ b/README.md @@ -155,15 +155,15 @@ Here is a quick **[demo](https://terminalizer.com/view/3f24561a4470)** shows how This table demonstrates the supported Python version of `Qlib`: | | install with pip | install from source | plot | | ------------- |:---------------------:|:--------------------:|:------------------:| -| Python 3.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Python 3.8 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | -| Python 3.9 | :x: | :heavy_check_mark: | :x: | +| Python 3.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | +| Python 3.10 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | +| Python 3.11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | +| Python 3.12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | **Note**: 1. **Conda** is suggested for managing your Python environment. In some cases, using Python outside of a `conda` environment may result in missing header files, causing the installation failure of certain packages. -1. Please pay attention that installing cython in Python 3.6 will raise some error when installing ``Qlib`` from source. If users use Python 3.6 on their machines, it is recommended to *upgrade* Python to version 3.7 or use `conda`'s Python to install ``Qlib`` from source. -1. For Python 3.9, `Qlib` supports running workflows such as training models, doing backtest and plot most of the related figures (those included in [notebook](examples/workflow_by_code.ipynb)). However, plotting for the *model performance* is not supported for now and we will fix this when the dependent packages are upgraded in the future. -1. `Qlib`Requires `tables` package, `hdf5` in tables does not support python3.9. +2. Please pay attention that installing cython in Python 3.6 will raise some error when installing ``Qlib`` from source. If users use Python 3.6 on their machines, it is recommended to *upgrade* Python to version 3.8 or higher, or use `conda`'s Python to install ``Qlib`` from source. ### Install with pip Users can easily install ``Qlib`` by pip according to the following command. @@ -181,7 +181,7 @@ Also, users can install the latest dev version ``Qlib`` by the source code accor ```bash pip install numpy - pip install --upgrade cython + pip install --upgrade cython ``` * Clone the repository and install ``Qlib`` as follows. @@ -189,7 +189,6 @@ Also, users can install the latest dev version ``Qlib`` by the source code accor git clone https://github.com/microsoft/qlib.git && cd qlib pip install . # `pip install -e .[dev]` is recommended for development. check details in docs/developer/code_standard_and_dev_guide.rst ``` - **Note**: You can install Qlib with `python setup.py install` as well. But it is not the recommended approach. It will skip `pip` and cause obscure problems. For example, **only** the command ``pip install .`` **can** overwrite the stable version installed by ``pip install pyqlib``, while the command ``python setup.py install`` **can't**. **Tips**: If you fail to install `Qlib` or run the examples in your environment, comparing your steps and the [CI workflow](.github/workflows/test_qlib_from_source.yml) may help you find the problem. diff --git a/qlib/__init__.py b/qlib/__init__.py index ac6d5683a6..c625907e78 100644 --- a/qlib/__init__.py +++ b/qlib/__init__.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from pathlib import Path -__version__ = "0.9.6" +__version__ = "0.9.6.99" __version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version import os from typing import Union