Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AttributeError: module 'configparser' has no attribute 'SafeConfigParser' #969

Closed
opoplawski opened this issue Jun 25, 2023 · 14 comments
Closed

Comments

@opoplawski
Copy link

When trying to build with Python 3.12:

+ /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/pandas-datareader-0.10.0/pyproject-wheeldir --output /builddir/build/BUILD/python-pandas-datareader-0.10.0-6.fc39.noarch-pyproject-buildrequires -t
Handling setuptools >= 40.8 from default build backend
Requirement satisfied: setuptools >= 40.8
   (installed: setuptools 67.7.2)
Handling wheel from default build backend
Requirement satisfied: wheel
   (installed: wheel 0.40.0)
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 555, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 451, in generate_requires
    generate_build_requirements(backend, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 274, in generate_build_requirements
    new_reqs = get_requires(config_settings=requirements.config_settings)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.12/site-packages/setuptools/build_meta.py", line 488, in run_setup
    self).run_setup(setup_script=setup_script)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/build_meta.py", line 338, in run_setup
    exec(code, locals())
  File "<string>", line 24, in <module>
  File "/builddir/build/BUILD/pandas-datareader-0.10.0/versioneer.py", line 1525, in get_version
    return get_versions()["version"]
           ^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pandas-datareader-0.10.0/versioneer.py", line 1452, in get_versions
    cfg = get_config_from_root(root)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pandas-datareader-0.10.0/versioneer.py", line 347, in get_config_from_root
    parser = configparser.SafeConfigParser()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

I think versioneer needs to get updated in your repo.

@sergiopasra
Copy link

I have the same problem when building pandas-datareader in Fedora. I have patched SafeConfigParser to ConfigParser and readfp to read_file. But here I suggest you update versioneer

@YaBoyBigPat
Copy link

I'm encountering the same problem.

@lethal233
Copy link

Same when installing pygeos

@bashtage
Copy link
Contributor

Fixed in main by removing versioneer.

@Hattiepi808
Copy link

@bashtage can you explain what you mean by "removing versioneer" or point me to documentation to do that? I am trying to install the spylon-kernel and am getting the same error.

@bashtage
Copy link
Contributor

Versioneer isn't compatible with modern Python. I removed it and replaced it with setuptools_scm in the main branch.

@chrishilsingerpate
Copy link

chrishilsingerpate commented Jan 16, 2024

Don't know if this is still active, but I would deeply appreciate any help. I don't have versioneer installed but am seeing issues with the versioneer.py when matplotlib is installed (checks an older version even though I have the newest version installed).

Collecting pyviz
  Using cached pyviz-0.10.3-py2.py3-none-any.whl (16.4 MB)
Collecting bokeh>=1.2.0 (from pyviz)
  Using cached bokeh-3.3.3-py3-none-any.whl.metadata (12 kB)
Collecting holoviews>=1.12.3 (from pyviz)
  Using cached holoviews-1.18.1-py2.py3-none-any.whl.metadata (20 kB)
Collecting hvplot>=0.4.0 (from pyviz)
  Using cached hvplot-0.9.1-py2.py3-none-any.whl.metadata (20 kB)
Collecting datashader>=0.7.0 (from pyviz)
  Using cached datashader-0.16.0-py2.py3-none-any.whl.metadata (11 kB)
Collecting panel>=0.6.0 (from pyviz)
  Using cached panel-1.3.6-py2.py3-none-any.whl.metadata (24 kB)
Collecting param>=1.9.1 (from pyviz)
  Using cached param-2.0.1-py3-none-any.whl.metadata (5.9 kB)
Collecting pyct>=0.4.6 (from pyct[cmd]>=0.4.6->pyviz)
  Using cached pyct-0.5.0-py2.py3-none-any.whl (15 kB)
Collecting ipython<=7.1.1,>=5.4.0 (from pyviz)
  Using cached ipython-7.1.1-py3-none-any.whl (764 kB)
Collecting numpy>=1.16.4 (from pyviz)
  Using cached numpy-1.26.3-cp312-cp312-macosx_10_9_x86_64.whl.metadata (61 kB)
Collecting rise (from pyviz)
  Using cached rise-5.7.1-py2.py3-none-any.whl (4.3 MB)
Collecting dask>=0.18.2 (from dask[complete]>=0.18.2->pyviz)
  Using cached dask-2024.1.0-py3-none-any.whl.metadata (3.7 kB)
Collecting notebook>=5.5 (from pyviz)
  Using cached notebook-7.0.6-py3-none-any.whl.metadata (10 kB)
Collecting matplotlib==3.0.3 (from pyviz)
  Using cached matplotlib-3.0.3.tar.gz (36.6 MB)
  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
  ╰─> [29 lines of output]
      Traceback (most recent call last):
        File "/Users/Chris/Desktop/spotifywebapp/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/Chris/Desktop/spotifywebapp/.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 "/Users/Chris/Desktop/spotifywebapp/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/c_/m3248b653bnb515zr8fdy6zc0000gn/T/pip-build-env-uy1zg7ek/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/c_/m3248b653bnb515zr8fdy6zc0000gn/T/pip-build-env-uy1zg7ek/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/c_/m3248b653bnb515zr8fdy6zc0000gn/T/pip-build-env-uy1zg7ek/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/private/var/folders/c_/m3248b653bnb515zr8fdy6zc0000gn/T/pip-build-env-uy1zg7ek/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 53, in <module>
        File "/private/var/folders/c_/m3248b653bnb515zr8fdy6zc0000gn/T/pip-install-5523grd_/matplotlib_cfb13b30d3ca4a04bb0ea2cd32afaf39/versioneer.py", line 1410, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/private/var/folders/c_/m3248b653bnb515zr8fdy6zc0000gn/T/pip-install-5523grd_/matplotlib_cfb13b30d3ca4a04bb0ea2cd32afaf39/versioneer.py", line 1344, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/c_/m3248b653bnb515zr8fdy6zc0000gn/T/pip-install-5523grd_/matplotlib_cfb13b30d3ca4a04bb0ea2cd32afaf39/versioneer.py", line 401, 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: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.```

@YaBoyBigPat
Copy link

If your using a juypter notebook in vscode try installing the packages or libraries through that. So in your notebook (not the terminal) try %pip install matplotlib, that's what worked for me. Hopefully that works, the other thing you can do is try deleting and reinstalling python in a file location that's convenient for you (normally it's the default "user" path and that's fine too). Then try installing the packages through the terminal or your notebook environment.

@chrishilsingerpate
Copy link

Thanks for your reply. That didn't quite work. I don't know if this context is helpful, but I'm working in a virtual environment in VSCode. I've tried recreating the environment but keep running into the same issue. The issue arises when downloading Pyviz (although it looks like the error occurs upon the matplotlib reference). I have a newer version of matplotlib than the one Pyviz seems to check. Thanks!

@aabdou
Copy link

aabdou commented Jan 17, 2024

Same error here installing google-colab. It seems to fail when installing pandas. I have Python 3.12 on my mac

`Collecting pandas~=0.24.0 (from google-colab)
Downloading pandas-0.24.2.tar.gz (11.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.8/11.8 MB 4.7 MB/s eta 0:00:00
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
╰─> [32 lines of output]
:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
:435: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
:436: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/Library/Frameworks/Python.framework/Versions/3.12/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'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^`

@bashtage
Copy link
Contributor

You need to use an older python which will then let you use an older pandas which has this available.

@papoteur-mga
Copy link

Hi,
Do you mean to give a release including this fix?

@moi90
Copy link

moi90 commented Jun 27, 2024

Versioneer isn't compatible with modern Python.

Yes, it is: https://github.com/python-versioneer/python-versioneer

Compatible with: Python 3.8, 3.9, 3.10, 3.11 and pypy3
Experimental support for Python 3.12.

@wj1218
Copy link

wj1218 commented Aug 12, 2024

报错提示:
module 'configparser' has no attribute 'configparser'
py版本是3.12
请问大伙解决了没有

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests