santoshlite / Empyrial

An Open Source Portfolio Backtesting Engine for Everyone | 面向所有人的开源投资组合回测引擎
https://empyrial.gitbook.io/empyrial/
MIT License
914 stars 124 forks source link

Versioneer broken when installing on python 3.12.0 #120

Closed kinskrig closed 7 months ago

kinskrig commented 7 months ago

When running pip install empyrial, below error message is given:

Collecting empyrial
  Using cached empyrial-2.1.3-py3-none-any.whl.metadata (614 bytes)
Requirement already satisfied: numpy in ./miniconda3/envs/revesture1/lib/python3.12/site-packages (from empyrial) (1.26.2)
Requirement already satisfied: matplotlib in ./miniconda3/envs/revesture1/lib/python3.12/site-packages (from empyrial) (3.8.2)
Collecting datetime (from empyrial)
  Using cached DateTime-5.4-py3-none-any.whl.metadata (33 kB)
Collecting empyrical (from empyrial)
  Using cached empyrical-0.5.5.tar.gz (52 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      /private/var/folders/sy/49bw_1y55j7fyzdy080n79p80000gn/T/pip-install-sblzswrz/empyrical_d194ecdd5052487aa8e80c4ca0cdb39f/versioneer.py:485: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/sy/49bw_1y55j7fyzdy080n79p80000gn/T/pip-install-sblzswrz/empyrical_d194ecdd5052487aa8e80c4ca0cdb39f/setup.py", line 79, in <module>
          version=versioneer.get_version(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/sy/49bw_1y55j7fyzdy080n79p80000gn/T/pip-install-sblzswrz/empyrical_d194ecdd5052487aa8e80c4ca0cdb39f/versioneer.py", line 1473, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/private/var/folders/sy/49bw_1y55j7fyzdy080n79p80000gn/T/pip-install-sblzswrz/empyrical_d194ecdd5052487aa8e80c4ca0cdb39f/versioneer.py", line 1406, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/sy/49bw_1y55j7fyzdy080n79p80000gn/T/pip-install-sblzswrz/empyrical_d194ecdd5052487aa8e80c4ca0cdb39f/versioneer.py", line 412, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I think versioneer needs to be removed and replaced with setuptools_scm as mentioned in below post with similar issue: https://github.com/pydata/pandas-datareader/issues/969#issuecomment-1786843855