amueller / word_cloud

A little word cloud generator in Python
https://amueller.github.io/word_cloud
MIT License
10.19k stars 2.32k forks source link

Unable to download wordcloud using python3.12 #733

Closed yeamu closed 12 months ago

yeamu commented 1 year ago

I don't have wordcloud in my environment, the error when I downloaded it for the first time

$ pip install wordcloud
Collecting wordcloud
  Using cached wordcloud-1.9.2.tar.gz (222 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
  ╰─> [29 lines of output]
      Traceback (most recent call last):
        File "C:\Users\My\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\My\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\My\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\My\AppData\Local\Temp\pip-build-env-r319sge_\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\My\AppData\Local\Temp\pip-build-env-r319sge_\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\My\AppData\Local\Temp\pip-build-env-r319sge_\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\My\AppData\Local\Temp\pip-build-env-r319sge_\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 13, in <module>
        File "C:\Users\My\AppData\Local\Temp\pip-install-z2znv06l\wordcloud_7a7633e00c2749ad8aa5074a2da9b730\versioneer.py", line 1480, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "C:\Users\My\AppData\Local\Temp\pip-install-z2znv06l\wordcloud_7a7633e00c2749ad8aa5074a2da9b730\versioneer.py", line 1412, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\My\AppData\Local\Temp\pip-install-z2znv06l\wordcloud_7a7633e00c2749ad8aa5074a2da9b730\versioneer.py", line 342, 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.

This error appears to be due to code in the versioneer.py file in the wordcloud package using the outdated SafeConfigParser which has been renamed to RawConfigParser in Python 3.12

I hope someone can help me, thanks

T1t4m1un commented 1 year ago

If there isn't a strict requirement for Python 3.12, rolling back to a lower version of Python, such as 3.11, could help.

yeamu commented 1 year ago

If there isn't a strict requirement for Python 3.12, rolling back to a lower version of Python, such as 3.11, could help.

Thanks for the reply, this is exactly how I solved it

mkirienye commented 1 year ago

After a few days of frustrations, I installed worldcloud on jupyter notebook (Python3.12) by doing the following;

  1. pip install --upgrade pillow
  2. pip install --upgrade wordcloud Everything worked fine.
i-salameh95 commented 1 year ago

Today I have the same issue on macOS version 13.6.1 with python 3.12 I tried downgrade the python version to 3.9 and tried again.. with no success any help on how to use this wonderful package on macOS ?

MagicFernandez commented 1 year ago

I have the same problem, I'm using python 3.12 in a Windows 11 64bits. I'm trying to install wordcloud using jupyter notebook and I can't solve it. I have tried to install the wheel file, also to use different sentences on cmd and I'm so frustrated </3. Please help

i-salameh95 commented 1 year ago

I have the same problem, I'm using python 3.12 in a Windows 11 64bits. I'm trying to install wordcloud using jupyter notebook and I can't solve it. I have tried to install the wheel file, also to use different sentences on cmd and I'm so frustrated </3. Please help

Try downgrade python to python 3.9 I have tried that on macOS and its working like a charm

MagicFernandez commented 12 months ago

The best solution was to downgrade Python to Python 3.11. everything worked.