Skip to content

fix: get_version bugs when I run python scripts/get_data.py#1992

Closed
cloudQuant wants to merge 1 commit into
microsoft:mainfrom
cloudQuant:main
Closed

fix: get_version bugs when I run python scripts/get_data.py#1992
cloudQuant wants to merge 1 commit into
microsoft:mainfrom
cloudQuant:main

Conversation

@cloudQuant
Copy link
Copy Markdown

Description

I using mac 15.3.2 (24D81) and python 3.11

when I install the qlib using this code:
git clone https://github.com/microsoft/qlib.git && cd qlib pip install .
and download data using this code in the qlib:
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
I get these errors:

@yuns-MacBook-Air-4 qlib % python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
Traceback (most recent call last):
  File "/Users/yunjinqi/Documents/source_code/qlib/scripts/get_data.py", line 5, in <module>
    from qlib.tests.data import GetData
  File "/Users/yunjinqi/opt/anaconda3/lib/python3.11/site-packages/qlib/__init__.py", line 7, in <module>
    __version__ = get_version(root="..", relative_to=__file__)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/yunjinqi/opt/anaconda3/lib/python3.11/site-packages/setuptools_scm/_get_version_impl.py", line 238, in get_version
    _version_missing(config)
  File "/Users/yunjinqi/opt/anaconda3/lib/python3.11/site-packages/setuptools_scm/_get_version_impl.py", line 188, in _version_missing
    raise LookupError(error_msg)
LookupError: setuptools-scm was unable to detect version for /Users/yunjinqi/opt/anaconda3/lib/python3.11/site-packages.

Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj

Alternatively, set the version with the environment variable SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${NORMALIZED_DIST_NAME} as described in https://setuptools-scm.readthedocs.io/en/latest/config/

Screenshots of Test Results (if appropriate):

image

Types of changes

  • [ x ] Fix bugs

@SunsetWolf
Copy link
Copy Markdown
Collaborator

Hi, @cloudQuant

The problem you are experiencing is due to the incomplete code you are pulling, it is recommended that you reinstall qlib using the following commands:

git clone https://github.com/microsoft/qlib.git 
cd qlib 
python -m pip install -e .

Once the reinstallation is complete, the problem should be resolved. There is no need to change the code.

@SunsetWolf SunsetWolf closed this Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants