AlphaPy icon indicating copy to clipboard operation
AlphaPy copied to clipboard

module 'configparser' has no attribute 'SafeConfigParser'

Open sachinbhoi29 opened this issue 11 months ago • 0 comments

Describe the bug When attempting to install pyfolio (version 0.9.2), I encounter an error during the wheel building process. The error occurs due to an AttributeError related to the use of SafeConfigParser in the versioneer.py file, which is not compatible with Python 3.12. The error suggests replacing SafeConfigParser with RawConfigParser as the former was deprecated in Python 3.12.

To Reproduce Steps to reproduce the behavior:

Create a virtual environment using Python 3.12. Run the command pip install pyfolio or pip install alphapy (which depends on pyfolio). See the error message during the wheel building process. Expected behavior The package should install successfully without errors related to SafeConfigParser.

Screenshots Image

Collecting pyfolio
  Using cached pyfolio-0.9.2.tar.gz (91 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      /tmp/pip-install-avd50slw/pyfolio_541a6373515348579df94dc5b423c991/versioneer.py:468: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "/mnt/c/PERSONAL_DATA/Startups/Blockchain/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/mnt/c/PERSONAL_DATA/Startups/Blockchain/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-4pk6enqq/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
  [Rest of the error message truncated for brevity]

Additional context

The error is caused because SafeConfigParser was removed in Python 3.12 and replaced by RawConfigParser. Updating the code to use RawConfigParser should resolve the issue.

sachinbhoi29 avatar Jan 20 '25 05:01 sachinbhoi29